2

Suppose I type $\frac{\text{foo}}{2}$ to produce a fraction with the text "foo" in the numerator. The "foo" text is smaller than the body text of the document if the math is inline.

Now I would like to type "bar" in plain text and have it be the same font size as the "foo" in the fraction. Is there a way to achieve this that works independently of the font packacge being used?

Four fouriernc, \small{bar} and \footnotesize{bar} look too big. \scriptsize looks too small.


To be clearer about my specific application, here is an MWE:

\documentclass{article}
\usepackage{amsmath,pgfplots,fouriernc}
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[axis lines=left,clip=false]
    \addplot{x} node [right] {$\frac{\text{foo}}{2}$};
    \addplot{x/2} node [right] {\scriptsize foo};
    \end{axis}
    \end{tikzpicture}
\end{document}

Which produces the following plot. Note that the text in the labels appears to be different in size.

enter image description here

To confirm this, I check the size of the two labels in photoshop:

enter image description here


Update: I realise that this indeed works in computer modern, but not for fouriernc, which is the font I am using. I changed the question accordingly.

5
  • Maybe \scriptsize? Mar 14, 2017 at 11:46
  • Try $\scriptstyle\text{bar}$ or $\scriptstyle\mathrm{bar}$?
    – Bernard
    Mar 14, 2017 at 11:50
  • Thanks. I think \scriptsize is too small.
    – Ubiquitous
    Mar 14, 2017 at 11:58
  • Actually you just have to use \scriptsize bar. I've measured (precision: 0.1 pt). Unless you don't use a standard font (Computer Modern or Latin Modern). B.t.w. \scriptsize is not used in the same context as \scriptstyle.
    – Bernard
    Mar 14, 2017 at 11:58
  • @Ubiquitous, can you give full MWE? \scriptsize matches exactly for me. Note it should be {\scriptsize bar} not \scriptsize{bar}. Mar 14, 2017 at 12:02

1 Answer 1

1

Use \scriptsize for both and \dfrac.

\documentclass{article}
\usepackage{amsmath,pgfplots,fouriernc}
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[axis lines=left,clip=false]
    \addplot{x} node [right] {\scriptsize$\dfrac{\text{foo}}{2}$};
    \addplot{x/2} node [right] {\scriptsize foo};
    \end{axis}
    \end{tikzpicture}
\end{document}

Here are the two words side by side

enter image description here enter image description here

enter image description here

You must log in to answer this question.

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