11

As a partial workaround for grid typesetting, I'd like to define variants of \small and \large that behave like their standard counterparts except that they use the line spacing of \normalsize. I know that I can look up the respective macro definitions for, e.g., the 10pt standard class option in size10.clo and accordingly define the new variants, e.g.,

\newcommand\largeVAR{\@setfontsize\largeVAR\@xiipt\@xiipt}

However, I'm looking for an automatic solution that works for all (possibly custom) .clo option files, i.e., one that dynamically adapts to the respective standard macro definitions.

Bonus points for a solution showing how to add starred macro versions (\small*, \large*).

2
  • 1
    The solution to the grid problem, is hidden in the multicols package. Whatever you do it always balances the grid, even with oddly sized figures. Floats are the major culprits for breaking a grid. A better approach would be to redefine headers etc, to be in multiples of the baseline skip.
    – yannisl
    Commented Dec 17, 2011 at 15:33
  • 5
    sorry not true. multicols doesn't do grids. All it does is trying to ensure that baselines at top and bottom of the columns agree. But depending on the spacing inside the column there may not be alignment elsewhere and definitely no alignment from page to page. Commented Dec 17, 2011 at 17:03

1 Answer 1

8
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{lipsum}
\makeatletter
\AtBeginDocument{\edef\@standardbaselineskip{\the\baselineskip}}
\let\@@small\small
\def\small{\@ifstar\s@small\@@small}
\def\s@small{\@@small\fontsize{\f@size}{\@standardbaselineskip}\selectfont}
\makeatother
\begin{document}
{\small\lipsum[2]}
{\small*\lipsum[2]}
\end{document}

enter image description here

It may work also for \large, but there's \lineskip to be taken into account. It definitely won't work for larger sizes than \large.

For \large the modification is similar:

\let\@@large\large
\def\large{\@ifstar\s@large\@@large}
\def\s@large{\@@large\fontsize{\f@size}{\@standardbaselineskip}\selectfont}

From my experiments, the baseline skip is uniform even between lines with descenders and lines with ascenders, with Computer Modern fonts. With other fonts it's not sure a priori. However I refuse to show the result, which is horrible. :)

7
  • +1 for pointing me to \f@size. Am I right that this solution assumes (perhaps according to standard LaTeX convention) that \normalsize is in effect at the begin of the document body?
    – lockstep
    Commented Dec 17, 2011 at 15:10
  • 1
    \normalsize is issued by \document, but before expanding the \AtBeginDocument tokens. That's why I put the definition of \@standardbaselineskip there. If this code comes after package loading, it should be safe.
    – egreg
    Commented Dec 17, 2011 at 15:16
  • Re: horrible result: \large* is intendend for sectioning headings not exceeding one line.
    – lockstep
    Commented Dec 17, 2011 at 15:23
  • @lockstep I heartfully hoped so. :)
    – egreg
    Commented Dec 17, 2011 at 15:27
  • @egreg I don't see any advantages in simply doing \renewcommand\large{\@setfontsize\large\@xiipt{\the\baselineskip}}, am I missing something?
    – yannisl
    Commented Dec 17, 2011 at 15:28

You must log in to answer this question.

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