quebra de linha para que ambas as linhas tenham a mesma largura

quebra de linha para que ambas as linhas tenham a mesma largura

Eu tenho uma longa sequência de texto e ocupa mais de uma linha. Quero que a quebra de linha aconteça para que a primeira linha e a segunda linha tenham a mesma largura. Como eu faço isso?

A very long line of text that wraps around to the other line and needs to be broken differently.

nisso (mais ou menos)

A very long line of text that wraps around to the 
other line  and needs  to be  broken  differently.

Responder1

Esta é uma proposta muito simplória: medir a largura do texto e colocá-lo em uma minipágina com metade desta largura.

\documentclass{article} 
\newcommand\BreakEven[1]{\setbox0\hbox{#1}%
\begin{minipage}{\dimexpr0.5\wd0}
#1
\end{minipage}}
\begin{document}
\BreakEven{A very long line of text that wraps around to the other line and
needs to be broken differently.}
\end{document}

insira a descrição da imagem aqui

Uma solução um pouco mais sofisticada: faça um loop até que o texto tenha largura suficiente para caber em duas linhas.

\documentclass{article} 
\newlength\TestWidth
\newlength\MyBaseLineskip
\newcommand\BreakEven[2][1.5]{\setbox0\hbox{#2\global\MyBaseLineskip=\baselineskip}%
\TestWidth=0.45\wd0\relax
\loop
\setbox0\hbox{\begin{minipage}{\TestWidth}
#2
\end{minipage}}
\ifdim\ht0>#1\MyBaseLineskip\relax
\advance\TestWidth by 1pt\relax
\repeat
\begin{minipage}{\TestWidth}
#2
\end{minipage}}
\begin{document}
\BreakEven{A very long line of text that wraps around to the other line and
needs to be broken differently.}

\BreakEven{\footnotesize\textit{Sundays in Advent at Prime, and on the day of Saint Paul the apostle}}
\end{document}

insira a descrição da imagem aqui

informação relacionada