3

I'm using the \uline command from the ulem package. But unfortunately it causes an error when used togehter with German quotation marks (\glqq,\grqq):

\documentclass[12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{ulem}

\begin{document}
{\glqq}These are German quotation marks.{\grqq}\\
\uline{This is an underlined sentence.}\\
%\uline{{\glqq}But both of them together do not work.{\grqq}} 
\end{document}

I commented out the last line. It causes an error and I don't know why. Thank you for your help!

4
  • Welcome to TeX.SX!
    – egreg
    May 4, 2015 at 20:48
  • Is it an option to put the quotation marks outside of the \uline{} command, like so? {\glqq}\uline{But both of them together do not work.}{\qrqq} May 4, 2015 at 20:58
  • 2
    Hide them in an \mbox{} May 4, 2015 at 21:00
  • @MathewCarrick: This would not underline the quotation marks then (underlining and quotation does not look very nice, in combination, however)
    – user31729
    May 4, 2015 at 21:01

1 Answer 1

3

The \mbox can protect the special quotation characters. In addition, I used the csquotes package for easy change of quotation style, wrapping it into a command called \afz (German Anführungszeichen -- quotation marks)

\documentclass[12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel,style=german]{csquotes}

\newcommand{\afz}[1]{\enquote{#1}}
\usepackage{ulem}

\begin{document}
\afz{These are German quotation marks.}

\uline{This is an underlined sentence.}

\uline{\mbox{\afz{But now all together it works.}}}
\end{document}

enter image description here

From the nice comments by Ulrike I should point that \mbox prevents line breaking, thereby destroying an important feature of the ulem package.

3
  • 1
    If you put the whole sentence in an mbox, there no line break is possible. May 4, 2015 at 21:11
  • That's true, but is that an issue so far?
    – user31729
    May 4, 2015 at 21:12
  • 1
    Could be. After all the OP could simply use \underline if line breaks don't matter. So you should imho mention that you are disabling the main feature of \uline. May 4, 2015 at 21:17

You must log in to answer this question.

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