1

Using the following code, the spacing between words and lines inside tikz nodes are too much.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\draw [thick,-latex](0,0) -- (9.,0);
\draw [thick,-latex](0,0) -- (0,7);

\draw [ultra thick, blue] (4.,4.4) +(-45:1.cm) node [black, xshift=1.4cm, yshift=-.28cm] {Demand of Imports} -- +(135:3.cm)  +(30:1.cm) node [black, xshift=1.4cm, yshift=.2cm] {$Demand\ of\ Exports$} -- +(-150:4.2cm);

\draw [thick, black, densely dotted] (0,4.92) node [minimum size=4.cm, xshift=-.68cm, yshift=.28cm, path picture={\draw [thick, black, solid, -latex'] (0,0) node [black, xshift=.24cm, yshift=-.2cm]{$1.30$} -- +(130:.5cm);}]{} node [black, xshift=-1.28cm, yshift=1.2cm, align=center] {Price\\buyers\\pay} -- ++(0:3.46);

\draw [thick, black, densely dotted] (0,4.4) node [minimum size=4.cm, xshift=-.88cm, yshift=.06cm, path picture={\draw [thick, black, solid, -latex'] (0,0) node [black, xshift=.44cm, yshift=0cm]{$1.00$} -- +(180:.4cm);}]{} node [black, xshift=-2.cm, yshift=.06cm, align=center] {Price\\without\\tax} -- ++(0:4.);

\draw [thick, black, densely dotted] (0,4.08) node [minimum size=4.cm, xshift=-.8cm, yshift=-.16cm, path picture={\draw [thick, black, solid, -latex'] (0,0) node [black, xshift=.38cm, yshift=0cm]{$0.80$} -- +(-130:.5cm);}]{} node [black, xshift=-1.28cm, yshift=-1.16cm, align=center] {Price\\sellers\\receive} -- ++(0:3.46);
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

How to decrease these inter word/line spacing.

Hany
  • 4,709

1 Answers1

4

You could use another font size with smaller baseline skip for the tikz image.

Never put text in math mode, one of the bad side effects is strange inter word spacing. If you want the words to be in italic, use \textit{...}.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\fontsize{11pt}{9pt}\selectfont
\draw [thick,-latex](0,0) -- (9.,0);
\draw [thick,-latex](0,0) -- (0,7);

\draw [ultra thick, blue] (4.,4.4) +(-45:1.cm) node [black, xshift=1.4cm, yshift=-.28cm] {Demand of Imports} -- +(135:3.cm)  +(30:1.cm) node [black, xshift=1.4cm, yshift=.2cm] {\textit{Demand of Exports}} -- +(-150:4.2cm);

\draw [thick, black, densely dotted] (0,4.92) node [minimum size=4.cm, xshift=-.68cm, yshift=.28cm, path picture={\draw [thick, black, solid, -latex'] (0,0) node [black, xshift=.24cm, yshift=-.2cm]{$1.30$} -- +(130:.5cm);}]{} node [black, xshift=-1.28cm, yshift=1.2cm, align=center,text width=1.5cm] {Price buyers pay} -- ++(0:3.46);

\draw [thick, black, densely dotted] (0,4.4) node [minimum size=4.cm, xshift=-.88cm, yshift=.06cm, path picture={\draw [thick, black, solid, -latex'] (0,0) node [black, xshift=.44cm, yshift=0cm]{$1.00$} -- +(180:.4cm);}]{} node [black, xshift=-2.cm, yshift=.06cm, align=center,text width=1.5cm] {Price without tax} -- ++(0:4.);

\draw [thick, black, densely dotted] (0,4.08) node [minimum size=4.cm, xshift=-.8cm, yshift=-.16cm, path picture={\draw [thick, black, solid, -latex'] (0,0) node [black, xshift=.38cm, yshift=0cm]{$0.80$} -- +(-130:.5cm);}]{} node [black, xshift=-1.28cm, yshift=-1.16cm, align=center,text width=1.5cm] {Price sellers receive} -- ++(0:3.46);
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

  • Thank you for your comment, but for display reasons I do not want to decrease the font size. I used 2 examples one with plain text and the other with math mode just to show that both gave me extra inter word spacing. – Hany Aug 08 '18 at 14:41
  • 2
    @Hany I don't decrease the font size, I decrease the skip and while I think this is a bad idea, you asked for less space between the lines. – samcarter_is_at_topanswers.xyz Aug 08 '18 at 14:43
  • Thank you. Your answer controlled the inter-line spacing. What about the inter-word spacing. – Hany Aug 08 '18 at 14:47
  • 2
    @Hany The incorrectly used math mode is the only extra spacing I see. All the other spaces are of normal size and should IMHO not be decreased. – samcarter_is_at_topanswers.xyz Aug 08 '18 at 14:49
  • OK, forget about the math mode. Is there a way to decrease inter-word spacing. – Hany Aug 08 '18 at 14:50
  • 2
    @Hany You could add a negative dimension after \\, e.g. \\[-1mm], and replace spaces by thin spaces \, for instance. –  Aug 08 '18 at 14:53
  • 2
    @Hany I don't think that is a great idea, but you can fiddle with the font settings: https://tex.stackexchange.com/q/23921/35864. Especially if this is for a presentation the reduced space does not help the legibility. – moewe Aug 08 '18 at 14:56
  • Thank you very much for your answers; I got what I needed. – Hany Aug 08 '18 at 15:00
  • 1
    @Hany \fontdimen2 is a global value, so you should save its original value prior to redefining it and restore it later. – moewe Aug 08 '18 at 15:00