6

What I want to achieve is, that every second line in a fonttable is drawn thicker than the others. I achieved this by renewing the commands responsible for the output:

\documentclass{article}

\usepackage{fonttable}

%Adjust fonttable output, so that each odd/even group becomes better visible through thicker lines
\makeatletter

%Adjust command for each group of 16 characters
\renewcommand{\f@tmorechart}{\cr\noalign{\hrule\hrule\hrule\penalty5000}
\f@tchartline \f@toddline \f@tm=\1 \advance\f@tm 1 \xdef\1{\the\f@tm}
\f@tchartline \f@tevenline}

%Adjust command for the end of the chart
\renewcommand{\f@tendchart}{\cr\noalign{\hrule\hrule\hrule}
\raise11.5pt\null&&&\f@thex 8&&\f@thex 9&&\f@thex A&&\f@thex B&
&\f@thex C&&\f@thex D&&\f@thex E&&\f@thex F&\cr
\egroup$$\par}
\makeatother

\begin{document}
\xfonttable{U}{pzd}{m}{n}
\end{document}

However instead of putting so much code in my document, I thought I could just patch the \hrule marco to print itself three times, when it is called and hence tried:

\let\OldHrule\hrule
\renewcommand{\hrule}{\OldHrule\OldHrule\OldHrule}

But I get an error now:

! Leaders not followed by proper glue.
<to be read again>
                   \OldHrule
l.23 \xfonttable{U}{pzd}{m}{n}

What is the problem here and is there a neat way to achieve, what I want?

1
  • @DavidCarlisle You meant \hline, I guess.
    – egreg
    Commented Dec 15, 2021 at 22:30

1 Answer 1

7

This answer does not explain why you get this error, but it suggests a workaround.

Patching \hrule (which would probably work using \let\OldHrule\hrule \renewcommand{\hrule}{\OldHrule height 2pt}) would make all \hrules thicker, which is probably not what you want.

But you can at least reduce the code using \patchcmd (I included the suggestion of @David Carlisle from the comments):

\documentclass{article}

\usepackage{fonttable}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\f@tmorechart}{\hrule}{\hrule height 1pt}{}{}
\patchcmd{\f@tendchart}{\hrule}{\hrule height 1pt}{}{}
\makeatother

\begin{document}
\xfonttable{U}{pzd}{m}{n}
\end{document}

enter image description here

1
  • 1
    Thanks @Jasper, well let's say I accepted, that this would change all future \hrules, but your solution is of course more elegant.
    – TobiBS
    Commented Dec 15, 2021 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .