0

EDIT: additional examples added (scroll farther down)

I've noticed there's always unnecessary space generated between the words when justified alignment of text is used (be it one or another package that does the alignment). I can definitely see all this empty space on each line making some space(?) for additional word (or two; depending on the width of a text container). Is there a way to tune things up a bit to make text justification more compact? What is your solution?

\documentclass[border=0.5mm]{standalone}
\usepackage{ragged2e}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \path node[draw,text width=3cm]
            {\begin{justify}this is just some text this is just some text this is just some text\end{justify}};
    \end{tikzpicture}
\end{document}

Looks about the same with TikZ' align=justify

when contents of tikzpicture are

\path node[draw,align=justify,text width=3cm]
    {this is just some text this is just some text this is just some text};

EDIT: Following are examples of how different ways of justifying text result in different inter-word spacing.

\path node[draw,text width=50mm]
    {\begin{justify}test \lipsum hello\end{justify}};

VS.

\path node[draw,align=justify,text width=50mm]
    {\begin{justify}test \lipsum hello\end{justify}};

results in

  • 1
    the large example basically just demonstrates the difference between default spacing and \frenchspacing. the answer using microtype is probably the only effective mechanism to comptess the text automatically. – barbara beeton Dec 4 '17 at 17:09
4

You can use \fussy, but in small text width this can lead to overfull line.

\documentclass[border=0.5mm]{standalone}
\usepackage{ragged2e}
\usepackage{tikz}
\usepackage{microtype}
\begin{document}
    \begin{tikzpicture}
        \path node[draw,text width=3cm,align=justify]
            {\fussy this is just some text this is just some text this is just some text\par};
    \end{tikzpicture}
\end{document}

enter image description here

  • This macro is one letter away from trouble. On a series note, it creates even more space than \justifying. Have you tried another text? – bp2017 Dec 5 '17 at 7:09
  • 1
    Fussy will never produce too much space. But you need the \par at the end so that tex doesn't go back to sloppy at the end of the paragraph. – Ulrike Fischer Dec 5 '17 at 8:05

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.