## #349 Cairolatex should use math mode for exponent

None
closed-out-of-date
nobody
None
5
2013-11-01
2012-10-20
Chili
No

Cairolatex currently writes large nubers in the tics in the form 2e+14. They would look much better if it would use the latex math mode ie. $2 \cdot 10^{14}$.

## Discussion

• Ethan Merritt
2012-10-20

The tic labels are written in whatever format you specify. The default is " %g" but you can change it to something else using the 'set format' command. In this case I think you want

set format '$%.2t \cdot 10^{%T}$'

See "help gprintf" and "help set format" and "help format specifiers"

• Ethan Merritt
2012-10-20

The tic labels are written in whatever format you specify. The default is " %g" but you can change it to something else using the 'set format' command. In this case I think you want

set format '$%.2t \cdot 10^{%T}$'

See "help gprintf" and "help set format" and "help format specifiers"

• Ethan Merritt
2012-10-20

• status: open --> open-works-for-me

• Chili
2012-10-24

Thank you sfeam!

Things now look much better. However, your solution brings me to another issue: '$%.2t \cdot 10^{%T}$' will always output the mantissa including 2 digits after the decimal point. Often this is too much information. Eg. consider the ticks are 10, 100 and 1000. In this case it is sufficient to output just the exponent ($10^{1}$, $10^{2}$ and $10^{3}$). The mantissa is not needed.

How can I tell gnuplot to set the format depending on its value?

I found this:

set format y ( ( ( <arg> > 1e-3 ) && ( <arg> < 1e2 ) ) ? "%2.1f" : "10^{%T}" )

But gnuplot 4.7 doesn't accept <arg>.

• Ethan Merritt
2013-11-01

• status: open-works-for-me --> closed-out-of-date
• Group: -->

• Ethan Merritt
2013-11-01

CVS now has a format "%h" that does this.