3

I have trouble displaying an abbreviation nicely. Removing largesmallcaps is a small improvement, but looks really bad in full document. I want normal numbers in the rest of the document.

How can I make the zero appear the correct size and differentiate it nicely from the O?

MWE:

\documentclass{article}
\usepackage[largesmallcaps]{kpfonts}
\begin{document}
1234567890
\oldstylenums{1234567890}
\textsc{lod}\oldstylenums{0}
\textsc{lod0}
\end{document}

enter image description here

2
  • 1
    It's not clear how you'd like the thing to be typeset. What do you believe is the “correct” size for the 0?
    – egreg
    May 28 '18 at 14:23
  • @egreg: I am by no means a typesetting expert, but my supervisor and I agree that with the current result (line 3) confusion could arise whether it is LOD0 or LODo. I don't know what the end result should look like, only that it needs changing. May 28 '18 at 14:40
2

I introduce a macro, \scht{} that sets its argument in \scshape and then stretches the result to the height of \textsc{x}.

\documentclass{article}
%\usepackage[largesmallcaps]{kpfonts}
\usepackage{scalerel}
\newcommand\scht[1]{\stretchrel*{$\textsc{#1}$}{\textsc{x}}}
\begin{document}
1234567890
\oldstylenums{1234567890}
\textsc{lod}\oldstylenums{0}
\textsc{lod0}
\textsc{lod\scht{0}}

\textsc{lod\scht{234}}
\end{document}

enter image description here

1
  • 1
    Since my uni supplies kpfonts in the thesis template this is the final macro: \newcommand{\scnum}[2]{\textsc{#1}\stretchrel*{\textsc{#2}\textsc{#2}\textsc{#2}}{\textsc{#1}}} May 28 '18 at 14:47
2

I'd avoid this style of abbreviations, if it can confuse the readers. Anyway, here's a possible solution: first I show the basic command I use, then also a solution for avoiding awkward input.

\documentclass{article}
\usepackage[largesmallcaps]{kpfonts}
\usepackage{graphicx}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\abbr}{m}
 {
  \tl_set:Nn \l_tmpa_tl { #1 }
  \regex_replace_all:nnN
   { ([0-9]+) } % any run of digits
   { \c{resizedigit}\cB\{ \1 \cE\} } % replace it with \resizedigit{...}
   \l_tmpa_tl
  \textsc{ \tl_use:N \l_tmpa_tl }
 }
\NewDocumentCommand{\resizedigit}{m}{\resizebox{!}{1ex}{#1}}
\ExplSyntaxOff

\begin{document}

Abc \textsc{lod\resizebox{!}{1ex}{0}} def

Abc \abbr{lod0} def

Abc \abbr{x12y3z} def

\end{document}

enter image description here

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.