TeX - LaTeX Asked by Ingmar on February 3, 2021
In the text I am writing I make extensive use of blockquotes, which I need to refer back to at a later point (kind of like numbered theorems, really). I use displayquote
for this purpose, and it works pretty much as expected. (The referring part is also taken care of, using label
)
documentclass[fontsize=11pt,BCOR=8mm]{scrartcl}
usepackage[main=ngerman]{babel}
usepackage[silent]{fontspec} setmainfont{Minion Pro}
usepackage{setspace}
usepackage[german=quotes]{csquotes}
usepackage{etoolbox} newcounter{quote}
AtBeginEnvironment{displayquote}{refstepcounter{quote}singlespacevspace{-.5em}smallitshape}
AtEndEnvironment{displayquote} {hfillrlap{scriptsizenormalfont[thequote]}vspace{-.5em}endsinglespace}
begin{document}
A bit of dummy text here to get us started, followed by the first quote:
begin{displayquote}
Bei [Gastmann] ist das Böse nicht der Ausdruck einer Philosophie oder eines Triebes, sondern seiner Freiheit: der Freiheit des Nichts. (S.~109) end{displayquote}
Not an issue; the quote is formatted as desired, and the counter is displayed.
begin{displayquote}Als jahrelanger Gesandter Argentiniens in China genieße er das Vertrauen der fremden Macht und als ehemaliger Verwaltungspräsident des Blechtrusts jenes der Industriellen.~(S.~73f.)
end{displayquote}
In this case, however, [2] is shown in the next line. This must be prevented, even at the cost of bleeding into the right margin.
end{document}
If I have a longer quote that fills the last line, however, my quote counter is shown in the next line, all by itself. I would like to prevent that from happening.
I am using LuaTeX, by the way. Not using fontspec
seems to solve this issue, but is not an option for obvious reasons.
Without being able to test this myself (don't have all the required packages and fonts available), I suggest "dropping back" to a basic TeX approach. This is not generally recommended. Only one definition needs to be revised:
AtEndEnvironment{displayquote} {hfillrlap{scriptsizenormalfont[thequote]}vspace{-.5em}endsinglespace}
In order to suppress the linebreak, it is necessary to overcome the space that may be inserted if end{displayquote}
is input on a new line. unskip
will accomplish this, and nobreak
will prevent (La)TeX from proceeding to a new line. It may be helpful (so that the number will be clearly separated from the end of the quote) to insert a small fixed space. Thus the following is suggested as the replacement for the first part of the definition:
AtEndEnvironment{displayquote} {unskipnobreak,hfill ...
Never leave a blank line before end{displayquote}
. That will always force the number to a new line -- unskip
works only in horizontal mode.
Answered by barbara beeton on February 3, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP