Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following code does not compile if any % is removed. It reports run away argument.

\documentclass{article}
\usepackage{ulem}
\begin{document}
    \begin{center} %\em
        This is center
    \end{center}
    \begin{quote} %\em
        This is quote
    \end{quote}
    \begin{itemize} %\em
        \item This is itemize
    \end{itemize}
    \begin{tabular}{c} %\em
        This is tabular
    \end{tabular}
\end{document}

My question is whether it is possible to fix it so that \em of ulem (as an underlining \em) works everywhere \em of LaTeX works.

share|improve this question
1  
\em with ulem wants to be terminated by }. –  egreg Aug 29 at 9:24

1 Answer 1

up vote 7 down vote accepted

The definition of \em with ulem becomes

\def\@tempa{\uline}%
\global\let\UL@ender\UL@swender
\expandafter\@tempa\expandafter{\ifnum\z@=\string`}\fi

This is an interesting trick for essentially turning

{\em something}

into

\uline{something}

A consequence of this is that \em needs to see an explicit closing brace and cannot be “free”.

Underlining cannot be done like a font change that respects any grouping mechanism, so the answer to your question is: no, you can't.

share|improve this answer
    
Thanks. So the next problem: why not make underlining a font feature so that we will have \ulshape and \textul? It is cheaper to draw a line than to tune, for example, the italic version, right? –  Symbol 1 Aug 29 at 9:41
2  
@Symbol1 One would need a special underlined font for this. But underlining a whole paragraph is something a typographer would do only under physical threat. –  egreg Aug 29 at 9:43
1  
You owe me a coffee and a new keyboard. But I'm still chuckling. –  Steven B. Segletes Aug 29 at 9:56
    
@StevenB.Segletes Sorry for your keyboard. ;-) –  egreg Aug 29 at 10:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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