[XeTeX] enumerating quotations

Tobias Schoel liesdiedatei at googlemail.com
Tue Apr 3 08:28:08 CEST 2012


Ah just have found the missing piece: \unskip. So try:

\documentclass{minimal}
\usepackage{fontspec}
\newcounter{myquotecounter}
\renewcommand{\themyquotecounter}{(Quote \arabic{myquotecounter})}
\newenvironment{myquote}{\refstepcounter{myquotecounter}„\ignorespaces}{\unskip“~\themyquotecounter}
\begin{document}
Hallo
\begin{myquote}
Dumdideldei\label{eins}
\end{myquote}
This is some text

\begin{myquote}
Yesterday …\label{zwei}
\end{myquote}

And now come the citations:
The first quote was \ref{eins} and after that came \ref{zwei}.

\end{document}


On 03.04.2012 05:03, Jacobo Myerston wrote:
> Ok. I think I should write my own macro containing quote and a label option on it. But I have never done that. Could you recommend a good tutorial?
>
>
>
> On Apr 2, 2012, at 3:37 PM, Zdenek Wagner wrote:
>
>> 2012/4/2 Jacobo Myerston<jmyerston at gmail.com>:
>>> Hi,
>>>
>>> I'm writing a book in which I quote a significant number of ancient texts. I'm using the \quote environment for this as usual. Now, I would like to have a numbered label to refer back to these quotations along the book. So, I would like the \quote environment to behave somehow like \figure so that the quote is auto-numbered and labels located inside \quote get also an automatic number.
>>>
>>> Does anybody how to do this?
>>>
>> I would design my own macros. First you have to define an environment
>> that will be used to display the quotations, i.e. in your document you
>> will write \begin{something} ... \end{something}. This is important
>> because it constitutes a group and the counter used for labeling must
>> be used inside a group. You also have to allocate a counter. When
>> entering the environment you have to increment the counter by
>> \refstepcounter. It is not sufficient to use \stepcounter, it only
>> increments the counter, but \refstepcounter also sets other internal
>> macros used by the \label-\ref-\pageref machinery. \label must appear
>> inside the environment but after \refstepcounter. You should also
>> define the way how tha couter value will be displayed. For instance,
>> the definitions may be:
>>
>> \newcounter{something}
>> \newcommand*\thesomething{\arabic{something}}
>>
>> If you need hierarchical numbering (starting from 1 in each chapter),
>> you have to define a few more macros.
>>
>>> I'm using memoir.
>>>
>>>
>>> --------------------------------------------------
>>> Subscriptions, Archive, and List information, etc.:
>>>   http://tug.org/mailman/listinfo/xetex
>>
>>
>>
>> --
>> Zdeněk Wagner
>> http://hroch486.icpf.cas.cz/wagner/
>> http://icebearsoft.euweb.cz
>>
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>>   http://tug.org/mailman/listinfo/xetex
>
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>    http://tug.org/mailman/listinfo/xetex


More information about the XeTeX mailing list