2

Here Align line with caption in Tikz pgfplot legend the legend alignment are wrong because of an entry that goes below the preset text depth=0.15em - see "default every axis legend style" on page 260 in the manual.

If the text depth is already set, how can it be unset? I tried text depth=false, text depth=none and text depth=\empty - of cause non of that worked.

MWE:

\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}[text depth=0pt]
\node[draw=red, inner sep=0pt] {$\frac{1}{2}$};
\end{tikzpicture}
\end{document}

Fraction 1/2 cut by red frame

Wanted output without removing [text depth=0pt]:

Fraction 1/2 in red frame

2

1 Answer 1

2

The code for text depth is

\tikzoption{text depth}{\def\tikz@text@depth{#1}}

and the initial value for \tikz@text@depth is empty.

Reset it locally to empty.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[text depth=0pt]
\node[draw=red, inner sep=0pt,text depth=] {$\frac{1}{2}$};
\end{tikzpicture}

\end{document}

output

4
  • That is certainly a way to achieve the desired output. I feel that is would not always be possible to do it like that. Commented Oct 18 at 16:45
  • 1
    @hpekristiansen Do you like the simpler method I found?
    – egreg
    Commented Oct 18 at 16:53
  • Thanks - that was really simple Commented Oct 18 at 16:56
  • @hpekristiansen With a bit of luck, also.
    – egreg
    Commented Oct 18 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .