1

I am struggling with a problem that occurs using \underline. From other posts I heard that there is no possiblity for linebreaks using this command. However, I tried using the ulem package. In fact, line breaks are possible but hyphenation is not. So, I face another problem. I have a continuous text with some underlined parts of a sentence which need line breaks as well as hyphenation.

How am I supposed to solve this?

My code:

\usepackage[normalem]{ulem}
\begin{document}
\begin{itemize}[leftmargin=*]
\item There is an item:
    \begin{itemize}

        %using \underline
        \item[] Lorem ipsum dolor sit amet, consetetur sadipscing
                elitr, sed diam nonumy eirmod
                 \underline{thereIsAReallyLongWord in a senctence} 
                aliquyam erat, sed diam voluptua.


        %using \uline
        \item[] Lorem ipsum dolor sit amet, consetetur sadipscing
                elitr, sed diam nonumy eirmod
                \uline{thereIsAReallyLongWord in a senctence} 
                aliquyam erat, sed diam voluptua.
    \end{itemize}
 \end{itemize}
 \end{document}

enter image description here

  • Please make a complete MWE from your code. And the long word you are mentioning probably would not break as it is not a real word. If I set the hyphenation using \- at the appropriate positions line breaking works. – epR8GaYuh Mar 8 '18 at 10:33
  • do you really have to use underlining (it is a typewriter convention rather rarely used in typeset material) ulem should work OK if you use hyphenatable text but if at all possible I would use a font change such as italic instead. – David Carlisle Mar 8 '18 at 10:36
3

It works with soul, but, please, don't use underlining.

\documentclass{article}
\usepackage{soul}

\begin{document}

\begin{itemize}
\item There is an item:
    \begin{itemize}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing
%          elitr, sed diam nonumy eirmod
          \ul{thereIsAReallyLongWord in a sentence}
          aliquyam erat, sed diam voluptua.
    \end{itemize}
\end{itemize}

\end{document}

enter image description here

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.