0

I have this command:

\newcommand{\showfont}
{%
    (\foreignlanguage{english}
    {%
        encoding: \f@encoding{},
        family: \f@family{},
        series: \f@series{},
        shape: \f@shape{},
        size: \f@size{},
        baseline: \f@baselineskip{}
    })
}

Which shows me details about my font on the current line. For example: (encoding: T1, family: cmr, series: m, shape: n, size: 12, baseline: 18.0pt )

How can I also put it to show the spacing between lines, i.e.: (linespacing: 15pt, encoding: T1, family: cmr, series: m, shape: n, size: 12, baseline: 18.0pt )

enter image description here

For example, supposing I am suing memoir and had set \OnehalfSpacing, it should show I have (linespacing: 15pt, ...):

\documentclass[10pt]{memoir}
\usepackage[english]{babel}
\OnehalfSpacing

\makeatletter
\newcommand{\showfont}
{%
    (\foreignlanguage{english}
    {%
        encoding: \f@encoding{},
        family: \f@family{},
        series: \f@series{},
        shape: \f@shape{},
        size: \f@size{},
        baseline: \f@baselineskip{}
    })
}
\makeatother

\begin{document}
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum has been the industry's standard dummy text ever since the 1500s, when an
unknown printer took a galley of type and scrambled it to make a type specimen
book. It has survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the 1960s
with the release of Letraset sheets containing Lorem Ipsum passages, and more
recently with desktop publishing software like Aldus PageMaker including
versions of Lorem Ipsum \showfont.
\end{document}
9
  • 2
    it is baselineskip, which you are showing already (might be better to show \baselineskip rather than \f@baselineskip) . why do you think the spacing should be 1.5cm ??? Nov 2, 2019 at 11:18
  • 1
    As David said, the actual value is stored in \baselineskip (which is what TeX uses to compute the line spacing). If you want to use LaTeX's parameters you need the product \f@linespread*\f@baselineskip. Nov 2, 2019 at 13:57
  • 1
    but a centimetre is just a standard unit of measurement if you look at two lines of text surely it is clear they are much less than a centimetre apart? It doesn't matter it just seemed a strange sort of guess:-) Nov 2, 2019 at 20:33
  • 1
    @user no. double spacing does not mean double \baselineskip and onehalf spacing does not mean multiply it by 1.5 Nov 2, 2019 at 20:34
  • 1
    the numbers are not exact but for example the setspace package multiplies the baselineskip by 1.25 for onehalf spacing and 1.667 for double spacing. Nov 2, 2019 at 20:37

1 Answer 1

0

After the comments, I build the command like this:

\usepackage[english]{babel}
\OnehalfSpacing

\makeatletter
\newcommand{\showfont}
{%
    (\foreignlanguage{english}
    {%
        encoding: \f@encoding{},
        family: \f@family{},
        series: \f@series{},
        shape: \f@shape{},
        size: \f@size{},
        baseline: \f@baselineskip{},
        linespread: \f@linespread{},
        linespacing: \the\baselineskip{}%
    })%
}
\makeatother

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.