3

Consider the code

\documentclass{book}

\usepackage{xcolor}
\usepackage{scalefnt}
\usepackage{amssymb}

\newcommand{\m}{\textcolor{blue}{{\scalefont{1.00}{\maltese}}}}
\newcommand{\M}{\textcolor{blue}{{\scalefont{3.00}{\maltese}}}}
\newcommand{\x}{\textcolor{red}{{\scalefont{1.00}{\bullet}}}}
\newcommand{\X}{\textcolor{red}{{\scalefont{3.00}{\bullet}}}}

\begin{document}
\noindent $\m$ \\[20pt]
$\M$ \\[40pt]
$\x$ \\[20pt]
$\X$
\end{document}

which produces

enter image description here

As you can see, the colorized and enlarged \maltese symbol as defined as \M seems to have been scaled properly, whereas, the colorized and enlarged \bullet symbol defined as \X is not being scaled at all. Am I doing something wrong?

QUESTION: What is preventing the newly defined colorized bullet point from being scaled properly; and how may I correct this?

Thank you.

3
  • I've no idea why \bullet is not enlarged. However, note that \scalebox does work, even if I guess it's not a super clean solution: \newcommand{\X}{\scalebox{3.00}{\textcolor{red}{$\bullet$}}}
    – tobiasBora
    Sep 21, 2021 at 14:44
  • Note also that you can use directly the utf-8 char • and it will scale well, but it won't work in math-mode directly since the math font does not have a symbol for it. See tex.stackexchange.com/questions/65599/… for a solution.
    – tobiasBora
    Sep 21, 2021 at 14:53
  • This isn't related to colour at all. Sep 21, 2021 at 15:56

1 Answer 1

3

You can't change font size in math mode. The scalefont package unfortunately seems to avoid making the warning that the standard \large would make, but it still can't work that way. Switch size in text mode.

enter image description here

\documentclass{book}

\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{scalefnt}
\usepackage{amssymb}

\newcommand{\m}{\textcolor{blue}{{\scalefont{1.00}{$\maltese$}}}}
\newcommand{\M}{\textcolor{blue}{{\scalefont{3.00}{$\maltese$}}}}
\newcommand{\x}{\textcolor{red}{{\scalefont{1.00}{$\bullet$}}}}
\newcommand{\X}{\textcolor{red}{{\scalefont{3.00}{$\bullet$}}}}

\begin{document}

\noindent \m \\[20pt]
\M \\[40pt]
\x \\[20pt]
\X
\end{document}
6
  • Thank you for posting this answer. It works fine on my end. But I'm confused about what you said about "You can't change font size in math mode." I defined the new maltese cross in exactly the same manner as the new bullet. However, the new maltese cross was scaled properly in the output, whereas the new bullet was not. In fact, the maltese scaling was correctly produced whether I used $\M$ or \M. Perhaps you would clarify this for me. Thank you.
    – DDS
    Sep 21, 2021 at 16:37
  • 1
    \maltese is defined using \mathhexbox so it is \mbox{$ some math stuff $} so the text font size change accidentally happens to affect the hidden nested math list. @mlchristians Sep 21, 2021 at 16:44
  • Question: Should all commands that are essentially just wrappers around \fontsize{size}{baselineskip}\selectfont give a warning/error when used in math mode? Mar 23 at 20:40
  • @User23456234 well if they don't give a higher level warning, then you will get a lower level one from \selectfont so depends how you value being friendly to users or being efficient on coding and run time by omitting the higher level tests Mar 23 at 21:35
  • 1
    @User23456234 standard commands like \large warn. If you call \selectfont directly then it doesn't want and just works as advertised, it changes the text font so if you use \mbox{abc} after it you would see the effect, but it has no effect on math fonts in the current math expression. Apr 2 at 7:55

You must log in to answer this question.

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