2

How to unline a given title and make the title wrap automatically according to the fixed width, I know I need to use the packages

\usepackage{ulem}
\usepackage{CJKulem}

and use it like this

\uline{This a very long title just for demonstration so how to make it  wrap automatically according to the fixed width}

It can warp automatically, but it fills the whole line of the page, I just want it warps according to fixed width such as 300pt, how can I achieve it?

enter image description here

  • You could put the text into a minipage or \parbox with the desired width, but why are you referring to the text as "title"? – campa Apr 21 '22 at 16:58
  • @campa Thank you very much Campa, "title" is just a case, could you give me an example of using \pardox or minipage? – Peter Yang Apr 21 '22 at 17:03
  • @campa, perfect, this is what I want, really appreciate your help very much Campa. – Peter Yang Apr 21 '22 at 17:14
  • @campa Moreover, could you tell me how to make the underline lengths of all lines same, since I noticed that the underline length of the last line varies according to the content of the sentence and it is not centered, how to fix this and make all the underline length same and the words of the last line centered. – Peter Yang Apr 21 '22 at 18:17

1 Answers1

2

You can put the text into a minipage or a \parbox.

\documentclass{article}

\usepackage{ulem}

\begin{document}

With \verb+minipage+: \begin{minipage}[t]{150pt} \uline{This a very long title just for demonstration so how to make it wrap automatically according to the fixed width} \end{minipage}

\bigskip

With \verb+\parbox+: \parbox[t]{200pt}{% \uline{This a very long title just for demonstration so how to make it wrap automatically according to the fixed width}}

\end{document}

enter image description here

campa
  • 31,130