1

I found this nice page with notes on LaTeX: https://unix4lyfe.org/tex-notes/#entry26

It gives this sample code:

\def\vhb#1{\vbox{\hbox{#1}}}

A vbox:
\vbox{\vhb{eight}\vhb{gnat}}
and a vtop:
\vtop{\vhb{eight}\vhb{gnat}}
on one line.

And also provides the output of this code "with visible boxes and baselines": enter image description here

How can I achieve the exact output? I found no way to make baselines and boxes visible.

EDIT: I am using pdflatex which I'd like to keep.

1

ConTeXt has the built-in command \showboxes which does what you want.

\showboxes
\starttext

\def\vhb#1{\vbox{\hbox{#1}}}

A vbox:
\vbox{\vhb{eight}\vhb{gnat}}
and a vtop:
\vtop{\vhb{eight}\vhb{gnat}}
on one line.

\stoptext

enter image description here

A similar thing is available with LuaLaTeX in the lua-visual-debug package.

\documentclass{article}

\usepackage{lua-visual-debug}

\begin{document}

\def\vhb#1{\vbox{\hbox{#1}}}

A vbox:
\vbox{\vhb{eight}\vhb{gnat}}
and a vtop:
\vtop{\vhb{eight}\vhb{gnat}}
on one line.

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.