# How to make baseline visible?

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":

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.

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


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}