Skip to main content
Simpler method
Source Link
egreg
  • 1.2m
  • 144
  • 2.7k
  • 4.4k

Raise by theThe code for \depthtext depth: is

\documentclass[tikz,\tikzoption{text border=1cm]depth}{standalone\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]sep=0pt,text {\raisebox{\depth}depth=] {$\frac{1}{2}$}};
\end{tikzpicture}

\end{document}

output

Raise by the \depth:

\documentclass[tikz, border=1cm]{standalone}

\begin{document}

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

\end{document}

output

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

Source Link
egreg
  • 1.2m
  • 144
  • 2.7k
  • 4.4k

Raise by the \depth:

\documentclass[tikz, border=1cm]{standalone}

\begin{document}

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

\end{document}

output