Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

As this issue: TikZ: Text becomes invisible in large PDF could not yet be solved, my constantly growing PDF needs to become even smaller to stay out of invisibility range. As a consequence, \tiny is now far too large. After managing to remove various problems with line breaks in scale boxes, the result looks like this:

Various font sizes and spacings

\documentclass[border=0pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily] at (0,0)
{ Abc \\ Def \\ Ghi };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily] at (1,0)
{ \tiny{Abc} \\ \tiny{Def} \\ \tiny{Ghi} };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily] at (2,0)
{ \scalebox{0.2}{Abc} \\ \scalebox{0.2}{Def} \\ \scalebox{0.2}{Ghi} };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily] at (3,0)
{ \scalebox{0.2}{Abc} \\ \vspace{-0.2cm}\scalebox{0.2}{Def} \\ \scalebox{0.2}{Ghi} };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily] at (4,0)
{ \scalebox{0.2}{Abc} \\ \vspace{-0.2cm}\scalebox{0.2}{Def} \\ \vspace{-0.2cm}\scalebox{0.2}{Ghi} };

\end{tikzpicture}
\end{document}

The goal of the project would be to display nodes containing an image and some text lines below. Right now, the spacing between the image and the text and between each of the text lines is the issue.

The first node has nothing to complain about. In the second node, the line spacing is already fairly large, even worse in the third node. In the fourth one, I tried to reduce the spacing by adding a negative vspace between Abc and Def: The result is not what I aimed at, even more so in the last node, where the text even leaves the node. In other experiments, the lower lines sometimes manage to go above the first line.

I assume the error comes from the scalebox that leaves the original y-spacing of the text unmodified, but attempts to change that failed.

Is there any way to resolve this weird spacing issue, and why does the vspace behave so unexpectedly here?

PS: Is there an easier way for displaying TeX output than snapshotting Adobe Reader?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Here is a tikz way using scale=<fraction> in the options of the \node itself.

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily] (a) at (0,0)
{ Abc \\ Def \\ Ghi };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily,scale=0.8,right=0.5cm of a] (b)
{ Abc \\ Def \\ Ghi };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily,scale=0.6,right=0.5cm of b] (c)
{ Abc \\ Def \\ Ghi };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily,scale=0.4,right=0.5cm of c] (d)
{ Abc \\ Def \\ Ghi };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily,scale=0.2,right=0.5cm of d] (e)
{ Abc \\ Def \\ Ghi };

\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
I completely forgot about this feature. Together with the image enlarged properly, it works like a charm! –  Brokenmind May 1 at 16:05

Text stacking might be of use here.

\documentclass[border=0pt]{standalone}
\usepackage{tikz}
\usepackage[usestackEOL]{stackengine}
\begin{document}
\begin{tikzpicture}
\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.5ex, font=\sffamily] at (0,0)
{ Abc \\ Def \\ Ghi };

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.2ex, font=\sffamily] at (1,0)
{ \tiny\Centerstack{Abc\\Def\\Ghi}};

\node[draw, fill=yellow!20, rectangle, align=left, inner sep=0.1ex, font=\sffamily] at (2,0)
{\scalebox{.2}{\Centerstack{Abc\\Def\\Ghi}}};

\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.