maranget / hevea

Hevea is a fast latex to html translator
http://hevea.inria.fr
Other
97 stars 12 forks source link

Introduce the macros `\phantom', `\hphantom', `\vphantom', and `\smash'. #41

Closed cspiel closed 3 years ago

cspiel commented 4 years ago

These definitions arose serendepitously from looking at CSS property visibility recalling the superficial similarity of \makebox with CSS inline-block.

Working example:

\documentclass{article}

\usepackage{hevea}
\usepackage{parskip}

\newstyle{body}{%
  margin: auto;
  max-width: 32em;
  line-height: 100\%;
  text-align: justify;
  width: 55\%;
}

\begin{document}
\section{\textbackslash phantom}
ABC.

A\phantom{B}C.

\section{\textbackslash hphantom}
$$
    \begin{array}{l}
      Side Middle Side  \\
      S\hphantom{ide\ }M\hphantom{iddle\ }Side  \\
    \end{array}
$$

\section{\textbackslash vphantom}
Without \verb+\vphantom+:

$$
    \sqrt{a}\cdot\sqrt{a^3}
$$

With \verb+\vphantom+:

$$
    \sqrt{\vphantom{a^3}a}\cdot\sqrt{a^3}
$$

\section{\textbackslash smash}
To demonstrate the effect of smash we need at least one line of
running text before it.  To compute the tetration
$\smash{2^{2^{2^2}}}$, evaluate from the top down, as $2^{2^{2^2}} =
2^{2^4} = 2^{16} = 65536$.
\end{document}