This works, but the length you get is quite unpredictable, because it depends on the current text direction.
\documentclass{article}
\usepackage{tikz}
\usepackage{luatexja}
\begin{document}
\tikz{\coordinate[yshift=\the\expandafter\ht\expanded{\strutbox}];}
\end{document}
It also works when \strutbox
is just a box register name, because it's unexpandable and so \expanded
returns \strutbox
.
In order to make this work with ProfCollege
, you can patch the macros in the package that use the construction
\documentclass{article}
\usepackage{ProfCollege}
\usepackage{luatexja}
\usepackage{etoolbox}
% the abstract version of the above
\newcommand{\getstrut}[1]{%
\the\expandafter#1\expanded{\strutbox}%
}
% the internal commands of ProfCollege to patch
\patchcmd{\TikzPH}{\the\dp\strutbox}{\getstrut\dp}{}{}
\patchcmd{\TikzPHD}{\the\dp\strutbox}{\getstrut\dp}{}{}
\patchcmd{\TikzPHD}{\the\dp\strutbox}{\getstrut\dp}{}{}
\patchcmd{\TikzPB}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzPBD}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzPBD}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzRH}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzRB}{\the\dp\strutbox}{\getstrut\dp}{}{}
% the user level command to patch
\patchcmd{\FlecheLineaireH}{\ht\strutbox}{\getstrut\ht}{}{}
\begin{document}
\Pourcentage[Calculer]{15}{39}
\verb+\hanzibox*[frametype=none]{我}[wo3][moi]\\[1ex]+
\begin{center}
\Propor[
Stretch=1.25,
Math,
GrandeurA=Hauteur $h$ (cm),
GrandeurB=\begin{tabular}{c}Volume (en cm$^3$) d'un cylindre\\ de rayon \Lg{5} et
de hauteur $h$\end{tabular},
Largeur=0.75cm
]{2/$50\pi$,3/$75\pi$,5/}
\end{center}
\FlecheLineaireH{1}{2}{3}{$+$}
\FlecheLineaireB{1}{2}{3}{$+$}
\end{document}
The only user level command that uses \ht\strutbox
is \FlecheLineaireH
, quite strangely without \the
, but I copied the example from the package documentation and it seems to work.
The previous caveat still applies: if you use different text directions as allowed by luatexja
, you'll get into troubles.

\strutbox
:) Since\tikz{\coordinate[yshift=\the\ht\strutbox];}
is part of a command of the packageProfCollege
I'm using, I can't change it. I'm facing the same problem as in tex.stackexchange.com/q/643376/18401: my real document makes use ofluatex-ja
features only exceptionally. So, is there a way to load them only locally in order they don't interfere with other parts of the document?lualatex
, which has to display in a (single) listing (typeset in monospaced font) both Latin and Chinese characters. I load it with\usepackage{luatexja-fontspec} \ltjsetparameter{jacharrange={-9}} \setmainjfont{FandolSong}
.