0

I have a use case in which I need to list all the inline quotes used in a journalistic type article at the end along with attribution. Something like:

START EXAMPLE Text text text "this is a quote," said person1. Text text text "and this is another," according to person2. ...

List of quotes:

"this is a quote" Person1, Title, Organization

"and this is another" Person2, Title, Organization

END EXAMPLE

I'm very new to Latex and not clear on the best approach. I made a quick botch of trying to get tocloft to work with one of the csquote commands (\textquote), based on examples I found online. Is this a feasible approach or are there other recommended approaches that would be sounder?

Thanks in advance

  • Welcome to TeX.SX! Indeed, your question is not really clear. Can you show your use case as a starter? – user31729 Jun 10 '16 at 20:22
  • Yes, the use case is to be able to list all the inline quotes in a document, along with attribution, So if a document has 6 "quotes like this one", and like "this one", then it would be possible to produce a "List of quotes", with attributions to the speakers, similar to lists of equations, figures, etc. – Ron Jun 10 '16 at 22:19
  • No, I meant your TeX document. – user31729 Jun 11 '16 at 5:52
1

I think it would be better to approach the problem in a similar style to citations. First define a set of quotes (just like you'd define a set of citations in a .bib file) and then use the ones you want in the document.

Here's an example using the glossaries package. The quotes are defined using the custom \newquote command that this example provides. To keep the example simple, I've just put them in the preamble, but if you have a lot of them, it's easier to put them in a separate .tex file (called, say, quotes.tex) and them load that file using \loadglsentries{quotes}.

\documentclass{article}

\usepackage{csquotes}
\usepackage{glossaries}

\makenoidxglossaries

% \newquote[options]{label}{name}{quote}{title}{organisation}
\newcommand*{\newquote}[6][]{%
 \newglossaryentry{#2}{name={#3},description={#4},%
    user1={#5},user2={#6},#1}%
}

% \usequote{label}{said}
\newcommand*{\usequote}[2]{\enquote{\glsdesc{#1},} #2 \glstext{#1}}

% Convert the first letter of the quote to upper case:
\newcommand*{\Usequote}[2]{\enquote{\Glsdesc{#1},} #2 \glstext{#1}}

\newglossarystyle{quotes}{%
  \setglossarystyle{index}%
  \renewcommand*{\glossentry}[2]{%
    \item\glsentryitem{##1}\glstarget{##1}{\enquote{\Glossentrydesc{##1}}}
    \glossentryname{##1}, \glsentryuseri{##1}, \glsentryuserii{##1}%
  }%
}
\newcommand*{\printquotes}[1][]{%
 \printnoidxglossary[sort=use,nogroupskip,style=quotes,%
   title={List of Quotes},#1]%
}

\newquote{smith1}{John Smith}{this is a quote}{President}{Smith \& co}
\newquote{doe1}{Jane Doe}{and this is another}{Galactic Ruler}{The Empire}
\newquote{smith2}{John Smith}{we retract our earlier statement}{President}{Smith \& co}

\begin{document}
Text text text \usequote{smith1}{said}.
Text text text \usequote{doe1}{according to}.
\Usequote{smith2}{said}.

\printquotes
\end{document}

As with tables of contents, cross-references etc this requires two runs to ensure the document is up to date. I'm assuming that you want the quotes listed according to the order of use in the document. I've used \enquote instead of \textquote for simplicity, but you can adapt it as required.

The resulting document looks like:

image of document

| improve this answer | |
  • Thank you very much for this example. I had found the glossaries package since my original post and come to the same conclusion. I made one minor modification to the style because I need the long form on the first usage, and just the surname after that. John Smith, President, Smith & co said "this is a quote". "We retract our earlier statement," exclaimed Smith. – Ron Jun 13 '16 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.