[Tex/LaTex] Adjustbox around an align* environment

adjustboxalign

I want to put an adjustbox around an align* environment such that the entire align* environment is scaled down to have a height of .1\textheight.
I tried

\documentclass{article}
\usepackage{adjustbox}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{showframe}

\begin{document}

\begin{figure}[h]
\begin{adjustbox}{max height=.5\textheight, max width=\textwidth}
\parbox{\linewidth}{
    \begin{align*}
        many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
    \end{align*}
}
\end{adjustbox}
\end{figure}

\end{document}

but this doesn't seem to work, i.e. the code is compiled but the align* environment is not at all scaled.
I get this:

enter image description here

What can I do?

Best Answer

To see what is happening I modified your example as below.

The typeout shows

550.0pt,275.01346pt,270.7204pt

so the height of the alignbox has been scaled to half of text height but it was vertically centred so it has almost equal depth and the end result is more or less \textheight again.

adjustbox has a max totalheight key for exactly this use.

\documentclass{article}
\usepackage{adjustbox}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{showframe}

\begin{document}

\begin{figure}[h]
\sbox0{\begin{adjustbox}{max height=.5\textheight, max width=\textwidth}
\parbox{\linewidth}{
    \begin{align*}
        many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
         many \\
        many \\
        lines \\
        go \\
        here \\
    \end{align*}
}
\end{adjustbox}}\usebox0
\typeout{\the\textheight,\the\ht0,\the\dp0}
\end{figure}

\end{document}
Related Question