The choice between ragged right or justified typesetting depends on the nature of the text you have to set. A discussion about this is mostly off-topic for this site, but some TeXnical aspects are surely on topic.
The algorithm TeX uses for breaking lines is equally good for both methods and can be tuned up to give a pleasing result: one can for instance choose to avoid hyphenation in ragged right text (the standard \raggedright
setting in LaTeX) or allow it (with \RaggedRight
from the ragged2e
package.
The facilities provided by microtype
can certainly be helpful also with ragged right typesetting. Here's an example, where the paragraph turns out to be one line longer without microtype
.
\documentclass{article}
\usepackage{microtype,kantlipsum}
\begin{document}
\raggedright
\kant[1]
\bigskip\hrule\bigskip
\microtypesetup{activate=false}
\kant[1]
\end{document}
Here's the result when we load ragged2e
and use \RaggedRight
instead of \raggedright,
thereby allowing hyphenation:
I should note that in this case one line turns out to be overfull when microtype
is active (top paragraph), precisely
Overfull \hbox (0.12758pt too wide) in paragraph at lines 7--7
\OT1/cmr/m/n/10 (+7) re-sen-ta-tion of, as far as I know, the things in them-se
lves; as I have shown else-
However, this is a false problem, because in a ragged right setting one can increase \hfuzz
to a higher value than the 0.1pt default. One should also tune up the parameters for microtype
more carefully.
Here's the last example, where the paragraph is set in two column mode, left with microtype
, right without it:
\documentclass{article}
\usepackage{microtype,kantlipsum,ragged2e,multicol}
\begin{document}
\RaggedRight
\begin{multicols}{2}
\kant[1]
\columnbreak
\microtypesetup{activate=false}
\kant[1]
\end{multicols}
\end{document}
I'll leave the evaluation of the result to personal judgment.
Best Answer
I assume you are referring to the spacing between words (or inter-word spacing) when you reference "a line text".
If the number of characters will always fit on the line, then the optional
s
-parameter for\makebox
alignment inserts enough inter-word spacing stretch to fill the box. If the text is greater than the box width, an overfull\hbox
warning is generated:The last line stretches beyond the text margin. In the above minimal working example (MWE), replacing
\linewidth
with\textwidth
would also work.For inter-letter spacing, the
soul
package can be of help. You define your own inter-letter, inner and outer spaces via a command\sodef{<cmd>}{<font>}{<inter-letter>}{<inner space>}{<outer space>}
:Since I am unfamiliar with this kind of modification, consider this just a guide to get you going. The
soul
package documentation (section 3 Letter spacing, p 8 onward) is filled with examples.I'm sure
microtype
would also be able to facilitate your needs.