# Small caps and underline create inconsistent underlining

I'm attempting to underline section headings in a document, and the behavior of particular letters (like "Q" and "q") as small caps makes the underlining match with the bottom of the lowest part of a letter (the tail in the Q) instead of the base of the letter. This creates an inconsistent look:

Here's a minimal example:

    \documentclass{article}

\begin{document}
The problem with Q'' is:

\underline{{\sc This is small caps text.}} \underline{{\sc This is quite weird underlining.}} \underline{{\sc Quite weird.}}

{\sc \underline{What if we change the order of operations, eh Q?}}
\end{document}

• Try with \underline{\scshape \smash{Q} ...}. – Werner Aug 14 '17 at 14:14

Any letter with a descender pushes the underline lower. You can get rid of this descender by using \smash (similar to \raisebox{0pt}[0pt][0pt]):

\documentclass{article}

\begin{document}

The problem with Q'' is:

\scshape
\underline{This is small caps text.}

\underline{This is \smash{q}uite weird underlining.}

\underline{\smash{Q}uite weird.}

\underline{What if we change the order of operations\smash{,} eh \raisebox{0pt}[0pt][0pt]{Q}?}

\end{document}


Other packages may provide more consistency:

\documentclass{article}

\usepackage{ulem}

\begin{document}

The problem with Q'' is:

\scshape
\uline{This is small caps text.}

\uline{This is quite weird underlining.}

\uline{Quite weird.}

\uline{What if we change the order of operations, eh Q?}

\end{document}


Similar output is obtained with a more uniform, lower underline under ulem and soul's \ul without having to resort to \smashing. Moreover, they allow for underlining with line-breaking.

• Thanks! This is great news -- smash seemed a bit overkill in macros. Will definitely \ul from now on (and \scshape). – Courtney Gibbons Aug 14 '17 at 22:19

Thanks to Werner for the answer -- I was using the antiquated two letter command "\sc" instead of the more robust "\scshape" which allows for the "\smash" command:

    \underline{\scshape Homework, \smash{Q}uizzes, ...}