3

Consider the following MWE

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document} \begin{tikzpicture}

\node[anchor=west, inner sep=0pt, draw, very thin, rectangle] (a) at (0,0) {\scalebox{15}{\sffamily LARGE}};

\node[anchor=west, inner sep=0pt, draw, very thin, rectangle] (b) at (0,-4) {\scalebox{3}{\sffamily smaller text}};

\draw[blue] (a.west) ++ (0,-2cm) -- ++(0,4cm); \draw[red] (a.west) ++ (-0.2cm,0) -- ++(0.4cm,0); \draw[red] (a.west) ++ (0,-0.2cm) -- ++(0,0.4cm);

\draw[blue] (b.west) ++ (0,-2cm) -- ++(0,4cm); \draw[red] (b.west) ++ (-0.2cm,0) -- ++(0.4cm,0); \draw[red] (b.west) ++ (0,-0.2cm) -- ++(0,0.4cm);

\end{tikzpicture} \end{document}

which produces this result:

result of MWE

Why is there some space between the "bounding box" and the letter L? I want to remove the white space around the text exactly, such that the vertical line of the L and the smaller text below align perfectly.

Further, I want to scale the smaller text such that it becomes exactly as wide as the top text. How is that possible?

T. Pluess
  • 1,040

1 Answers1

6

It has nothing to do with tikz. tikz can only use the font metrics, it doesn't see the ink and the letters do have side bearings:

\documentclass{article}
\usepackage{tikz}
\usepackage[showframe]{geometry}
\parindent=0pt
\begin{document}

\fontsize{1cm}{1.3cm}\selectfont \sffamily LARGE

TEST

XXX

\tikz[overlay]\drawred--++(0,5); \end{document}

enter image description here

Ulrike Fischer
  • 327,261
  • 2
    You are only viewing it as a problem because you are trying to use the letter as a graphic, in running text you actually expect letters to have side bearings and not to touch each other. – Ulrike Fischer Jul 28 '20 at 15:43