# Best text “f” in mathmode

Closely Related To : Ugly spacing around f in math mode . I wonder how I should define an "f" that does not designate a function, but is just standard lettering. For example, I have contributors that may want to write ax + by + cz + and on occasion they letter all the way beyond f. (It would be better if they chose different naming schemes, but this is not my call.) So, I am thinking:

\newcommand{\f}{\hspace{-3pt}f\hspace{-5pt}}


as in

\documentclass[12pt]{article}

\usepackage{charter}
\usepackage{amsmath}

\begin{document}

\Huge

text test abcdefghi

text test \textit{abcdefghi}

math test $abcdefghi$  --- bad

math test $\text{a}\text{b}\text{c}\text{d}\text{e}\text{f}\text{g}\text{h}\text{i}$ --- not italic

math test $abcde\text{f}ghi$ --- bad

math test $abcde\text{\it f}ghi$ ---still bad

math test $abcde\hspace{-0.1em}fghi$ --- better

math test $abcde\hspace{-3pt}f\hspace{-5pt}ghi$ --- better

\newcommand{\f}{\hspace{-3pt}f\hspace{-5pt}}

math test $abcde{\f}ghi$ --- same

\end{document}


is this the recommended way of doing this? and if I wanted all "f" to lose their special appearance in math mode, how would I do this?

regards, /iaw

• I'd just use abcdef if you do not like the f in some font, choose a different font, anything else is likely to lead to pain. there is nothing special about f in tex math mode, just as every other letter it is just whatever the font designer chose. – David Carlisle Mar 10 '17 at 18:05
• You might try \newcommand{\f}{\mkern-2mu f\mkern-3mu} -- use math length units in math mode... – Mico Mar 10 '17 at 20:57
• I think I understand. all math mode characters are different from all text mode characters. it just so happens that most italicfont lowercase letters look similar to mathfont. moreover, by "convention" the "f" symbol in math designers use more spacing left and right. correct? the best that one can do then is to follow mico's recommendation. – ivo Welch Mar 10 '17 at 22:36
• Not all maths mode characters are different from all text mode characters. Whether this is true depends, but it is false by default because a single font is used for operators and upright serif text. – cfr Mar 11 '17 at 2:06
• Note that you should NOT use two-letter font switches in LaTeX 2e documents. For example, don't use \it. {\it f} is going to give you a crappy result regardless of mode because you've forgotten to include any italic correction. If you don't want to think about that, don't use TeX font commands (which have other disadvantages and should be avoided for those reasons anyway). – cfr Mar 11 '17 at 2:11

(Thanks, Mico:) I believe the best answer is

 \newcommand{\f}{\mkern-2mu f\mkern-3mu}


and then use math test $abcde{\f}ghi$. This spacing works for the charter font. Other fonts may have different spacing, and the spacing may need to be adjusted (or even removed). This solves the main part of the question. I am now enclosing a sample, where (relative to my original post), only the \f has changed to the mkern definition.

I do not know how to override all mathfont f's in this way, but this was less important.

Hope this has helped.

\documentclass[12pt]{article}
\usepackage{charter,fourier}
\usepackage{amsmath}
\newcommand{\f}{\mkern-2mu f\mkern-3mu}
\begin{document}
\obeylines % just for this example
text test abcdefghi
text test \textit{abcdefghi} --- text italics
math test $abcdefghi$  --- bad
math test $\text{abcdefghi}$ --- not italic
math test $abcde\text{f}ghi$ --- bad
math test $abcde\textit{f}ghi$ ---too tight
math test $abcde{\f}ghi$ --- better
\end{document}

• If you have time, can you give some screenshots of the look of your original test code and this solution? :-) I think this helps thousands of guests in the future. – Eric Mar 12 '17 at 4:14
• thx for the suggestion. done. – ivo Welch Mar 12 '17 at 17:47
• I've taken the liberty of posting a new screenshot, to show an example that uses the fourier math font package. (Your original screenshot employed Computer Modern math along with the Charter text font, making for a slightly questionable look...) Happily, \newcommand{\f}{\mkern-2mu f\mkern-3mu} "works" for fourier/charter as well as it does for Computer Modern. – Mico Mar 12 '17 at 19:10