40

I live in a funny part of the world where we're required to quote text like this: „quotes“ (note the difference between the opening and closing quote).

Is there an easy way to set up a LaTeX document so that I could just type the usual double quotes that are on my keyboard ("like this"), and the LaTeX document processor would replace them to the ones that I need („like this“)?

I know I could just use ,, (two commas) and `` (two grave accents) in the LaTeX source file, but this seems like a step-back from what Microsoft Word has to offer at this point ;-)

If LaTeX (or XeTeX, or whatever) can't do that by itself, is there a way to preprocess the LaTeX document with some sort of an regular expression (somehow embed the regexp in the document)?

EDIT:

The language in question is Lithuanian.

babel doesn't do what I want; I don't know if it's supposed to.

What I would like to achieve is the automatic "" => „“ replacement. Quoting text with anything more than a single keystroke doesn't seem efficient to me ;-)

9
  • 14
    Why don't you use the csquotes package?
    – Thorsten
    Dec 21, 2011 at 6:48
  • Just out of curiosity what language is that?
    – Canageek
    Dec 21, 2011 at 6:51
  • @Linas Did you try babel with Lithuanian?
    – yannisl
    Dec 21, 2011 at 7:10
  • 1
    @Thorsten, could you give an example of how this would work with csquotes? Dec 21, 2011 at 8:38
  • 1
    For single occurrence also \documentclass{article} \usepackage[T1]{fontenc} \begin{document} Text \quotedblbase text\textquotedblright{} text. \end{document} might be noted.
    – Stephen
    Dec 21, 2011 at 9:29

3 Answers 3

40

Using the csquotes package allows logical mark up of quotes. That includes 'short' quotes, which I personally would avoid but was asked for so ...

\documentclass{article}
\usepackage[german]{babel}
\usepackage{csquotes}
\MakeOuterQuote{"}
\begin{document}
\enquote{Labas rytas}

"Labas rytas"
\end{document}

(Lithuanian babel doesn't seem to work 'out of the box', so I've used German as the standard quotation style is the same.)

3
  • 4
    But if the wanted language is Lithuanian, doesn't the \usepackage[german]{babel} load the German hyphenation patterns?
    – morbusg
    Dec 21, 2011 at 11:12
  • 1
    @morbusg Yes, this was just so that the demo worked. I'm assuming that someone writing in Lithuanian will have a working babel set up for that language, and can therefore make the necessary adjustments to the above. (As it stands, the question does not only apply to Lithuanian, so I hope this is reasonable. After all, you could ask the same thing for German!)
    – Joseph Wright
    Dec 21, 2011 at 11:16
  • 1
    I ended up doing this: \usepackage[lithuanian,german]{babel} \usepackage{csquotes} \MakeOuterQuote{"} \selectlanguage{lithuanian} Feb 16, 2012 at 19:10
6

For Czech, I get better results when using german quotations, as both German and Czech quote using 99text66, whereas croatian uses 99text99. According to https://en.wikipedia.org/wiki/Quotation_mark, the Lithuanian style should be the same as the Czech one, so I assume german would be a better option than croatian for Lithuanian as well.

The code I use to get Czech quotes is the following:

\usepackage[czech]{babel}
\usepackage{csquotes}
\DeclareQuoteAlias{german}{czech}
\MakeOuterQuote{"}

I assume this should be the correct way for Lithuanian as well, just swap czech with lithuanian in the code. I see no need to load german into babel or to use selectlanguage.

1
  • FYI, I am talking about Czech in the answer, because I came here from a question specifically asking for Czech quotations (tex.stackexchange.com/questions/109168/…), which was marked as duplicate of this one, although it had been answered only partially. I have not found the proper way to handle Czech quotes using csquotes online and had to do my own research for that. However, I cannot add my findings as an answer to the original and more appropriate question as it had been closed as duplicate. Sep 20, 2015 at 12:28
5

If you're in Windows, TeXnicCenter can also do it for you... (replacing " with the correct replacement as you type).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .