Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need to change the font from the standard cnr to Times. I tried \usepackage{times} but that did not change the font of the tick mark numbers on the axes. I pasted the code and an image of the output below. As is seen in the image, the digits on the axes are still formatted to cnr, although the rest of the graph is formatted to Times. How can I get the digits on the axes tick marks to be formatted to Times?

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3, width=70mm, height=60mm} %use to get tight spacing of labels to tickmarks. Not enabled by default because it affects the spacing.
\usepackage[tightpage,active]{preview}
\usepackage{times}
\begin{document}
\begin{preview}
\begin{tikzpicture}
\pgfplotsset{every axis legend/.append style={
font={\tiny}}}
\begin{semilogyaxis}[
legend pos = north east,
unbounded coords=jump,
xmin=-50,
xmax=1000,
ymin=1e-5,
ymax=1e-1,
minor x tick num = {2},
tick style={color=black},
xtick={0, 300, 600, 900},
ytick={1e-2, 1e-3, 1e-4},
every tick/.append style={thin,black},
xlabel=xlabel (times),
ylabel=ylabel (times),
after end axis/.append code={
               \draw[black,dotted] (axis cs:200,1e-5) -- (axis cs:200,1e-1);
               \node [rotate=90,anchor=north west] at (axis cs:200, 1e-5) {\tiny{side one (times)}};
               \node [rotate=90,anchor=south west] at (axis cs:200, 1e-5) {\tiny{side two (times)}};
             }]
\addplot+[mark=nothing,
thin,
solid,
black
]
coordinates {(0, 5e-3) (500, 6e-2) (900, 9e-4)};
\addplot+[mark=nothing,
thin,
dashed,
black
]
coordinates {(0, 1e-3) (300, 1e-2) (1000, 3e-4)};
\end{semilogyaxis}
\end{tikzpicture}
\end{preview}
\end{document}

enter image description here

share|improve this question
1  
The digits are set in math mode. So you need to change the math fonts. You can try \usepackage{mathptmx} or one of the other times-like math fonts. tex.ac.uk/cgi-bin/texfaq2html?label=psfchoice –  Ulrike Fischer Oct 22 '12 at 12:21
add comment

1 Answer 1

up vote 4 down vote accepted

times is obsolete. Use mathptmx or txfonts or txfontsb instead, which will change math fonts (like the digits in your axis) also into times. Refer this answer for a quick reference of obsolete packages.

Putting \usepackage{mathptmx} into your code gives

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3, width=70mm, height=60mm} %use to get tight spacing of labels to tickmarks. Not enabled by default because it affects the spacing.
\usepackage[tightpage,active]{preview}
%\usepackage{mathptmx}
%\usepackage{txfonts}
\usepackage{txfontsb}
\begin{document}
\begin{preview}
\begin{tikzpicture}
\pgfplotsset{every axis legend/.append style={
font={\tiny}}}
\begin{semilogyaxis}[
legend pos = north east,
unbounded coords=jump,
xmin=-50,
xmax=1000,
ymin=1e-5,
ymax=1e-1,
minor x tick num = {2},
tick style={color=black},
xtick={0, 300, 600, 900},
ytick={1e-2, 1e-3, 1e-4},
every tick/.append style={thin,black},
xlabel=xlabel (times),
ylabel=ylabel (times),
after end axis/.append code={
               \draw[black,dotted] (axis cs:200,1e-5) -- (axis cs:200,1e-1);
               \node [rotate=90,anchor=north west] at (axis cs:200, 1e-5) {\tiny{side one (times)}};
               \node [rotate=90,anchor=south west] at (axis cs:200, 1e-5) {\tiny{side two (times)}};
             }]
\addplot+[mark=nothing,
thin,
solid,
black
]
coordinates {(0, 5e-3) (500, 6e-2) (900, 9e-4)};
\addplot+[mark=nothing,
thin,
dashed,
black
]
coordinates {(0, 1e-3) (300, 1e-2) (1000, 3e-4)};
\end{semilogyaxis}
\end{tikzpicture}
\end{preview}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.