% LaTeX macros to put reference lines above and below characters
% \newcommand{\lastedit}{2025-05-06 17:00:28 by stolfi}

\makeatletter \endlinechar=-1

  % A horizontal line with nominal height/depth 0pt, extending across the enclosing box:
  \newcommand{\ghosthrule}{
    \hrule height 0pt depth 0pt
    \kern -0.15pt
    \hrule height 0.30pt depth 0pt
    \kern -0.15pt
    \hrule height 0pt depth 0pt
  }

  % A vertical line with nominal width 0pt, extending across the enclosing box:
  \newcommand{\ghostvrule}{
    \vrule width 0pt
    \kern -0.15pt
    \vrule width 0.3pt 
    \kern -0.15pt
    \vrule width 0pt
  }

  % Two reference lines just above and below the current x-height:
  \newcommand{\tblines}[1]{
    \hbox to #1{
      \hss
      \vbox to 1ex{
        \offinterlineskip\parindent=0pt
        \textwidth=#1\relax
        \hrule height 0pt depth 0pt
        \vss
        \kern -0.2ex
        \ghosthrule
        \kern 1.4ex
        \ghosthrule
        \kern -0.2ex
        \vss
        \hrule height 0pt depth 0pt
      }
      \hss
    }
  }

  % Display something with top and bottom x-height ref lines:
  % Usage: \withtblines{WIDTH}{STUFF}
  \newcommand{\withtblines}[2]{
    \hbox to #1{
      \hss
      \hbox to 0pt{\hss\textcolor{rosso}{\tblines{#1}}\hss}
      \hbox to 0pt{\hss\hbox{#2}\hss}
      \hss
    }
  }
  
\makeatother \endlinechar=`\^^M
