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.

David Carlisle
  • 757,742
DDS
  • 8,816
  • 4
  • 9
  • 36
  • 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 '21 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 https://tex.stackexchange.com/questions/65599/utf-8-characters-in-latex-math-mode for a solution. – tobiasBora Sep 21 '21 at 14:53
  • This isn't related to colour at all. – David Carlisle Sep 21 '21 at 15:56

1 Answers1

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}

David Carlisle
  • 757,742
  • 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 '21 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 – David Carlisle Sep 21 '21 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? – User23456234 Mar 23 '24 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 – David Carlisle Mar 23 '24 at 21:35