Journal home page
General information Submit an item Download style files Copyright Contact us |
Ask Nelly is a question and answer column. Nelly is the quiet person who sits at the back corner desk, who knows a lot, and when asked any question is always ready with a patient answer. If Nelly doesn't know the answer, Nelly will know an expert who has the answer. Feel free to Ask Nelly about any aspect of LaTeX, TeX, Context, etc.
|
|
Q: Dear Nelly: When I write course materials for my students, I often include quotations at the beginning of a chapter. I've defined my own Quotation environment for that. It typesets the quotaton in a minipage and sets the name of the author flushed right in italics on a new line . I was wondering, however, is it possible to make LaTeX typeset the name of the author on the same line as the last words, if there is enough space, and automatically start a new line if there isn't? A: There is indeed! You can define an author environment like this: \newcommand{\author}[1]{% \unskip\hspace*{1em plus 1fill}% \nolinebreak[3]\hspace*{\hfill}\mbox{\emph{#1}}% }be sure to use \hspace* rather than \hspace because the starred version makes sure that the space you so painstakingly created doesn't immediately disappear again if your author name is long enough to require a line of its own.
|
Page generated June 9, 2010 ; TUG home page; join TUG/renew membership; webmaster; facebook; x; mastodon.