2

Some of the figures I make with pgfplots use pgfmath to calculate the tick positions for the extrema of a function, with code similar to the one given here.

However, these numbers seem to always be typeset in math mode (I can tell because I'm using oldstyle numerals). I've come across a similar problem when I would normally use \pgfmathprintnumber, but find that this is also (understandably) typeset as math by default.

Is there a way to use the pgfmath number parsing code, but then typeset that number in text mode?

I can provide a MWE, but I don't know how useful it would be in this case.

4
  • 1
    Is \mathrm{} what you need?
    – Sigur
    Apr 27, 2015 at 10:21
  • Yeah, this works: $\mathrm{\pgfmathprintnumber{1983.00000000000}}$. I'll have to figure out how to put that into the tick style somehow, but I guess that's a different question. :)
    – jja
    Apr 27, 2015 at 10:38
  • 1
    Yes the MWE would be useful if only to clarify your question -- however see my Answer here tex.stackexchange.com/questions/228396/… Apr 27, 2015 at 10:54
  • I'll try to put together a MWE for this, but these two comments do everything I need. You answer on that other question did what I wanted in the plots.
    – jja
    Apr 27, 2015 at 11:07

1 Answer 1

3

In the absence of MWE.. you need this rather paradoxical bit

begin{axis}[
tick label style={/pgf/number format/assume math mode=true},%<=== here
]
2
  • It is rather a shorthand without the bold part assume that you are already in math mode
    – percusse
    Apr 30, 2015 at 6:32
  • Note that minus sign will be typesetted as if you insist on doing this. There is always \mathrm as suggested in the comments.
    – user202729
    May 3 at 4:27

You must log in to answer this question.

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