计算标题高度,如果标题高度高于某个数字,则添加一些空间

计算标题高度,如果标题高度高于某个数字,则添加一些空间

计算标题高度,如果标题高度高于某个数字,则添加一些空间。

当我使用代码获取标题时,但是当我使用这样的代码时 \settoheight{\heightoftitle}{\vbox{\title{Hello}}} 标题变为空

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}

\begin{document}
\newlength{\heightoftitle}
\settoheight{\heightoftitle}{\vbox{Hello }}
Value = \the\heightoftitle
\end{document}

当我使用以下编码时,我没有得到标题的准确高度

\documentclass{article}

\makeatletter
\newcommand{\settominwidth}[1]{\saltyegg@settomin{\wd}{#1}}
\newcommand{\settominheight}[1]{\saltyegg@settomin{\ht}{#1}}
\newcommand{\settominheights}[1]{\saltyegg@settomin{\ht}{#1}}
\newcommand{\settomindepth}[1]{\saltyegg@settomin{\dp}{#1}}

\newcommand{\saltyegg@settomin}[3]{%
  #2\maxdimen
  \@for\next:=#3\do{%
    \sbox\z@{\next}%
    \ifdim#1\z@<#2%
      #2=#1\z@
    \fi}%
}
\makeatother

\newlength{\saltyeggtest}

\begin{document}
\title{sample title sample title sample title sample title sample title sample title\settominheight{\saltyeggtest}{sample title sample title sample title sample title sample title}\the\saltyeggtest}
\maketitle
%makte

\settominwidth{\saltyeggtest}{a,b,c,f}
\the\saltyeggtest

\settominheight{\saltyeggtest}{sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title sample title }
\the\saltyeggtest 


\settomindepth{\saltyeggtest}{a,b,c,f}
\the\saltyeggtest

\end{document}

相关内容