7

One of the great features of csquotes is that, using \MakeAutoQuote, we can simply type proper hard-coded quotation marks and have csquotes do the rest, i.e. turn them into the correct format (as defined by language, typography etc.), plus take care of nesting:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage[babel]{csquotes}
\usepackage{lipsum}

\MakeAutoQuote{»}{«}
\MakeAutoQuote*{›}{‹}

\begin{document}
\lipsum*[1]
»\lipsum*[2] »[...]««
\lipsum*[3]
\blockquote{\lipsum*[2] »[...]«}
\end{document}

In my documents, I use » + « and + exclusively (placed on an easy-to-reach position on my keyboard), no matter what language I'm writing in, no matter what the quotation marks are required to look like in print. Csquotes will treat them as \enquotes. That's perfect ...unless we're talking about a longer quote which we'd like to automatically be turned into block format. What I'd like to have is an even smarter autoquote that behaves like \blockquote rather than \enquote, i.e. that will switch to block format if the anticipated length hits a certain threshold. That way, I could uniformly use » and « throughout my document without having to manually consider the quote's length.

Unfortunately, \MakeAutoQuote seems to be linked to \enquote rather tightly (§4.1 of csquotes doc). What would be a way of changing that, and are there any pitfalls that I'm not aware of at the moment?

FOLLOW-UP

prompted by @cfr's and Ulrike's replies, I came up with (the idea of) what some might consider a somewhat dirty workaround. If we can use \mkblockquote to define the block quotes' precise format, why not change the function of our active blockquoting chars (e.g. » and «) after the beginning of each instance of a block quote -- to become active textquoting chars inside the block quote? And give them back their block quote function at the very end?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage[babel]{csquotes}
\usepackage{lipsum}

% define » and « to trigger a block quote
\MakeBlockQuote{»}{|}{«}

\renewcommand{\mkblockquote}[4]{%
% inside a block quote, make them trigger a text quote
\MakeAutoQuote{»}{«}%
#1#2#3#4%
% now they resume functioning as block quote triggers again
\MakeBlockQuote{»}{|}{«}
}%

\begin{document}
\lipsum*[1]
»\lipsum*[2]«
»\lipsum*[2] »[...]««
\lipsum*[3]

\end{document}

Apparently, this is not how it works. I had hoped \MakeBlockQuote would work like, say, \renewcommand, but csquotes doesn't seem to accept a re-definition of the active blockquote chars. Even this construction causes an »invalid argument error«:

\MakeBlockQuote{»}{|}{«}
\MakeBlockQuote{>}{|}{<}

It's as if, once defined, the block quotes are inseperably tied to those chars. Or is there a way we can make this work somehow?

  • Can you define the characters outside the preamble? (I've never tried but I wonder if that's the problem?) – cfr Jul 30 '14 at 11:28
  • looks like we can't. This (pastebin.com/hgmDiwU3) doesn't work either. – Nils L Jul 30 '14 at 11:41
  • I was afraid of that. I seemed to remember that this needed to be done in the preamble. – cfr Jul 30 '14 at 12:25
  • so for now we're stuck with the question: why is it only possible to assign a particular active char to \MakeBlockQuote once and for all? That seems so un-TeX-y to me. – Nils L Jul 30 '14 at 12:44
  • The documentation claims active quotes should work in the document body so I'm wrong about the preamble bit. (It just says they work in the preamble or config file as well.) – cfr Jul 30 '14 at 21:03
7

Maybe I'm missing something but why not define your active characters to use \MakeBlockQuote instead? I guess this doesn't allow you to specify inner/outer marks specifically but if csquotes is taking care of the nesting in any case, perhaps that is not too much of a problem. (I define both outer and inner but never actually use the inner ones for just this reason.)

\documentclass[british]{article}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{kantlipsum}
\MakeBlockQuote{<}{|}{>}
\begin{document}

  \kant[2]
  <\kant[1]>

  \kant[3]

  Some more text. <This is a short quote.>
  `This is another short quote.'

\end{document}

Automatic quotations?

The final short quote is just for purposes of comparison.

EDIT

Ulrike Fischer has pointed out that you cannot nest block quotations with csquotes (but you can nest regular LaTeX block quotations).

What you can do is combine the above method with the use of regular active quote characters and csquotes will figure out the nesting correctly. Whether this is a significant limitation or not probably depends on the kind of work you do. If you regularly need to typeset block quotations which include other block quotations, it will obviously not be a good solution. If that is a relatively rare occurrence, perhaps not so much.

\documentclass[british]{article}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
   \MakeAutoQuote{‘}{’}
   \MakeAutoQuote*{“}{”}
\usepackage{kantlipsum}
\MakeBlockQuote{<}{|}{>}
\begin{document}

  \kant[2]
  <\kant[1]>

  \kant[3]

  Some more text. <This ‘is’ a short quote.>
  `This is another short quote.'

\end{document}

Nesting semi-automatically

  • You can't nest blockquotes. Try out <This is <a> short quote.>. – Ulrike Fischer Jul 29 '14 at 12:25
  • 1
    I guess that's probably one of those pitfalls I wasn't aware of until now. – Nils L Jul 29 '14 at 12:26
  • @UlrikeFischer You can use active quote characters within the block quotes, though. So you could write <This is ‘a’ short quote.> (where ‘’ are set up as active) and csquotes will figure out the nesting correctly. This wouldn't be a significant limitation for me but I guess it might be for somebody quoting text including a lot of dialogue, for example. Anyway, should I delete this? – cfr Jul 29 '14 at 12:33
  • this does look good, although it implies that the user would have to take care of the nesting themselves, i.e. take caution that inside the outer marks (triggering blockquote), different inner marks (triggering textquote) are used. This would defeat my the second part of my goal -- being able to type quotation marks in a uniform style throughout the document -- but will indeed provide for the desired automation, which is great. – Nils L Jul 30 '14 at 6:27
  • PS: I edited my original question to include a new attempt at a solution. – Nils L Jul 30 '14 at 7:33

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.