3

I use relsize to create a pretty version of the string "C++". This produces warnings when put into footnotes or small environments, because the result would be "too small". How can I prevent this without having to resort to a different macro for those situations?

This is a MWE:

\documentclass{scrbook}
\usepackage{xspace}
\usepackage{relsize}
\usepackage{hyperref}

\def\cpp{\texorpdfstring{\protect C\nobreak\hspace{-.05em}\raisebox{.4ex}{\relsize{-3}\textbf{++}\xspace}}{C++}}

\usepackage{scrhack}
\begin{document}

\chapter{one}

\cpp\ works

foobar\footnote{\cpp\ produces warning}

\chapter{two \cpp}

\end{document}

The warning produced is:

Package relsize Warning: Font size 5.20834pt is too small.
(relsize)                Using 6.0pt instead on input line 18.

I have tried using \scalebox{.5}{\textbf{++}} instead of relsize. This works nicely for the footnote, but then the command cannot be used as part of a chapter-title anymore.

1 Answer 1

2

Reading the documentation one can find

These limits are controlled by the commands \RSsmallest and \RSlargest, which get set automatically when relsize.sty is loaded, but you can redefine them to other length values:

Which leads to

\documentclass{scrbook}
\usepackage{xspace}
\usepackage{relsize}
\usepackage{hyperref}
\renewcommand\RSsmallest{5pt}
\def\cpp{\texorpdfstring{\protect C\nobreak\hspace{-.05em}\raisebox{.4ex}{\relsize{-3}\textbf{++}\xspace}}{C++}}

\usepackage{scrhack}
\begin{document}

\chapter{one}

\cpp\ works

foobar\footnote{\cpp\ produces warning}

\chapter{two \cpp}

\end{document}
1
  • I had thought 6pt was a LaTeX wide general lower limit or something like that, so I didn't look into the relsize documentation. Your solution works perfectly!
    – user188968
    Commented Feb 7, 2020 at 18:03

You must log in to answer this question.

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