PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : How to write text between chapter and its title?



direku
27-03-2007, 20:44
Hallo, (sorry leute, I'm going to ask my question in english)

I would like to put on the right side of the space between the chapter and the chapter's title some text, e.g.

=====================================
Chapter 1
.................................. "some wise saying"
...........................................Mr.Some body

Introduction
=====================================

I guess I have to \def\@chapter.., but I'm not very familiar with the latex language and some ready to use code would be very helpful. The modification should be done by redefining @chapter with an additional parameter so as to pass in the desired text or a dummy blank. If any simpler solution exists, even better.

Vielen Dank

localghost
27-03-2007, 20:58
What you are looking for is called an epigraph. There is a package with the identical name epigraph (http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=epigraph). Everything you need is described in the documentation. An alternative could be the quotchap (http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=quotchap) package. But you better choose on your own. The text is not exactly typset as you wish, but better than nothing.

sofa-surfer
27-03-2007, 21:22
Hi,

if you are using a Koma document class you don't need any extra package. You may use the command \dictum instead, e.g.:


\documentclass{scrreprt}

\renewcommand{\raggeddictumtext}{\raggedleft}
\renewcommand{\dictumwidth}{.2\textwidth}
\begin{document}

\setchapterpreamble[u]{%
\dictum[Mr.Some body]{some wise saying}%
}
\chapter{bla}

\end{document}

Matthias

direku
27-03-2007, 22:00
Hi localghost,

I am writing my thesis. The documentclass that I am using is handmade from some former PhD in our department.

epigraph package seems closer to what I want save that it puts the epigraph text between the title and the body and underlines the text.

quotchap package changes the appearance of the chapter numbering, which I don't want.

Now code may be extracted from either of them to put into mythesis.sty file. here is the code I have for chapter numbering


\makeatletter
\def\@makechapterhead#1{%
\vspace*{10\p@}%
{\parindent \z@ \centering \reset@font\hrulefill\,\,\,
{\Large \bfseries \scshape \@chapapp{} \,\Large
\textcolor{CadetBlue} \thechapter }\,\,\,\hrulefill
\par\nobreak
\vspace*{10\p@}%
\interlinepenalty\@M
\vspace*{10\p@}%
\begin{flushleft}
\LARGE \bfseries #1
\end{flushleft}
\par\nobreak
\par
\vspace*{10\p@}%
\vskip 40\p@
}
}


Do you have any idea how to insert the epigraph into the above code?

Hoffe, dies mal, habe ich klar gewessen.. (sorry for my lame german)

localghost
27-03-2007, 22:21
Regarding LaTeX, i'm not a workman. I prefer to use packages rather than to realize very individual wishes. That's what word processors are for. But the real experts here might help you with this problem. Sorry, but my knowledge and my efforts are ending here.

rais
28-03-2007, 01:15
Hi,


Now code may be extracted from either of them to put into mythesis.sty file. here is the code I have for chapter numbering


\makeatletter
\def\@makechapterhead#1{%
(..)
}


I guess this isn't enough: if I change this procedure to accomodate an epigraph (some citation and an author), it'll look s.th. like this:


\def@makechapterhead#1#2#3{...}
that is, instead of one parameter, the function will expect three (unless the additional ones are made optional) still, the calling procedure needs to be adapted accordingly (or you just get the defaults... in case of optional arguments).
In the standard report class, this would be \@chapter (which would need to get the additional two arguments), or \@schapter (the asterix-variant... `s´ as in `star´), as well as \chapter itself.
Let me put it this way: it's not easy, but not impossible, either. Still, in order to provide you with a workable solution, I for one would need to know the definition of \chapter (and the one(s) it calls), since you're using a class file I know nothing about---and your interface will be \chapter...
Unless you'll decide to have a second command (like \mychapter), where \chapter remains unchanged, and \mychapter will give you this additional functionality of an epigraph---think about it, I won't need to change the standard behavior of \chapter... perhaps I even won't have to bother about asterix, and non-asterix variants...
Or whoever is actually taking on this challenge;-)

KR,

direku
28-03-2007, 02:21
Hi rais,

The class file I am using is the one linked below, or very similar to this (didn't find the last update which is Feb 2000). I inserted the makechapterhead code myself, disregarding any other dependencies, because I wanted a colored chapter number. It seems to work. If you are able to give me some modified code which inserts the epigraph and won't have side effects on other parts of the latex file, that would be sufficient for my needs.

ftp.ktug.or.kr/tex-archive/macros/ latex/contrib/ut-thesis/ut-thesis.cls

Danke schoen fuer irgendeine Loesung

direku
29-03-2007, 17:18
Hi again,

I would like to thank localghost for suggesting the epigraph package.
I didn't read carefully its document but the package offered what
I wanted by changing some parameters.

Bis naechsten mal, bleib gut leute.

rais
29-03-2007, 22:33
That's good, because I don't really like what I did with the code (off report.cls, which is loaded by your ut-thesis.cls file---in the link (skipping an extra space in front of latex), at least) :


\documentclass{report}
\usepackage{color,setspace}
\newlength{\chepiwidth}\setlength{\chepiwidth}{0.5 \textwidth}
\newcommand{\chepigraph}[2]{%
\parbox{\chepiwidth}{%
\begin{spacing}{0.9}%
{\raggedleft\rm\normalsize\textit{``#2''}

---\textsc{#1}}%
\end{spacing}
}%
}%\chepigraph{author}{quotation}
\makeatletter
\renewcommand\chapter{\if@openright\cleardoublepag e\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter@i\@schapter}
\def\@chapter@i[#1]{%
\@ifnextchar[{\@chapter@ii[#1]}{\@chapter@ii[#1][\empty]}%
}
\def\@chapter@ii[#1][#2]{%
\@ifnextchar[{\@chapter[#1][#2]}{\@chapter[#1][#2][\empty]}%
}

\def\@chapter[#1][#2][#3]#4{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#4}{#3}{#2}]%
\else
\@makechapterhead{#4}{#3}{#2}%
\@afterheading
\fi}
\def\@makechapterhead#1#2#3{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\ifx#3\empty\vskip 20\p@\fi
\fi
\ifx#3\empty\relax\else\hfill\chepigraph{#3}{#2}\v skip 20\p@\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\tableofcontents
\chapter[foo TOC][Ghengis Khan][I just love a ride through the country, lots of new people to meet\dots]{foo heading}
Text\dots

\chapter[bar TOC]{bar heading}

\chapter*{baz}
\end{document}


You should stay with the epigraph package---I'd do the same, if the situation was reversed---I just want to know if I ``pushed the right buttons´´ ;-)

PS) my `quote´ is taken from Robert L. Asprin, somewhere in his myth series---``Another fine Myth´´´, that sort of thing:D

KR,

direku
31-03-2007, 00:01
Hi rais,

Thanks a lot for your effort. I wish I had more time to play with and understand the latex code you suggested. What I did is

==================================
\usepackage{epigraph}

\renewcommand{\epigraphwidth}{3in}
\renewcommand{\epigraphrule}{0pt}

\chapter{Introduction}
\epigraphhead[150]{\epigraph{some wise saying}{Mr.Some body}}

Here the chapter text goes..
==================================

which gave me the desired result.

Alles gute.