# Need the height of the descent

I'm creating a few custom icons for my latex documents that are repeated using tikz.

However, in order to align them to the text I need to know the descent to set the baseline in the correct place. I also want the descent to be calculated depending on font size.

I might need other measures from that picture too.

Here is one example.

\documentclass{article}
\usepackage{tikz}
\newcommand{\increasing}{%
\begin{tikzpicture}[baseline=0]
\draw[->] (0,0) -- (1ex,1em);
\end{tikzpicture}
}
\begin{document}
f \increasing
\end{document}


I want the arrow to be lower, so I need to set baseline=descent in the tikzpicture. How can I do that? Any documentation of the rest of the heights?

Something like this?? I set the baseline to the depth of the g descender and the top of the arrow to the height of the X, using the active font size.

\documentclass{article}
\usepackage{tikz}

\newcommand{\increasing}{%
\setbox0=\hbox{Xg}%
\begin{tikzpicture}[baseline=\dp0]
\draw[->] (0,0) -- (1ex,\dimexpr\ht0+\dp0\relax);
\end{tikzpicture}
}
\begin{document}
\Large fg\increasing
\normalsize fg\increasing
\tiny fg\increasing
\end{document}


• I didn't mention before, but I would like the figure to scale when using different font sizes like \Large. I believe this measures the descent of a normal g always. – mendus Jan 30 '18 at 15:01
• @mendus I edited to measure the current font size – Steven B. Segletes Jan 30 '18 at 15:01
• @StevenB.Segletes it would be nice to add a g too next to f. (+1) – koleygr Jan 30 '18 at 15:03
• @koleygr Done, per request. – Steven B. Segletes Jan 30 '18 at 15:04
• @StevenB.Segletes It looks fine now, the result is what I was looking for, so I'll accept the answer. Anyway, I wonder if creating the dummy box can be avoided, and inquire the current font about those values. – mendus Jan 30 '18 at 15:11

You can measure the maximum descender:

\documentclass{article}
\usepackage{tikz}

\newcommand{\showbaseline}{%
\settodepth{\alphabetdepth}{fgjpqy}
\makebox[0pt][l]{\vrule width 5cm height -\alphabetdepth depth \dimexpr\alphabetdepth+0.1pt\relax}%
\ignorespaces
}

\newlength{\alphabetdepth}
\newcommand{\increasing}{%
\settodepth{\alphabetdepth}{fgjpqy}%
\begin{tikzpicture}[baseline=\alphabetdepth]
\draw[->] (0,0) -- (1ex,1em);
\end{tikzpicture}%
}
\begin{document}

\showbaseline
f \increasing\quad {g \increasing} {\itshape f \increasing}

\bigskip


The \showbaseline command is just for making clear where the maximum depth is located.