# stix package mixes fonts

I'm trying to make my article figures compatible to the font of the journal, which uses the stix package. To that end I use the standalone package. The problem is that with one set of options I get the 'H' character I need, and with another set of options I get the 'w' character I need. Why can't I get both the characters no matter what options I choose for the STIX package? The code is

\documentclass[border=10pt, convert={size=640x}]{standalone}
%\usepackage{capt-of}
\usepackage{varwidth}
\usepackage{graphicx}
\usepackage[dvipsnames,svgnames,table]{xcolor} % use color
\usepackage{amsmath} % AMS Math Package
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the Sym­bol, Chancery and Com­puter Modern fonts
\usepackage{tikz}
\usepackage[customcolors]{hf-tikz}
\hfsetfillcolor{black!10}
\hfsetbordercolor{black!0}
\usepackage{pgfplots}
\usetikzlibrary{plotmarks, calc, spy, pgfplots.polar}
%\tikzexternalize[prefix=./figures/tikz/]
\usepgflibrary{shapes.geometric}
%\usepackage[notext, nomath]{stix}
\usepackage[notext, nomath, lcgreekalpha]{stix}
\usepackage[safe]{tipa}
\newcommand{\scOmega}{\text{\textscomega}} % small omega
\newcommand{\heavis}{\mathcal{H}}

\begin{document}
\begin{tikzpicture}[scale=1]
\begin{axis}[
ymin=-0.2,ymax=1.2,
unit vector ratio*=1 1 1,
yticklabel style={text width=3em,align=right},
xtick={0,1.25,2},
xticklabels={$0$, $w$, $1$},
ytick={0., 1.},
width = 6cm,
domain=0:1,
y domain=-0.75:0.75,
legend style={at={(0.01,1.)}, anchor=north west,draw=none},
cycle list name=black white,
every axis y label/.style={at={(current axis.north west)},xshift=-0pt}
]

\addplot [thick,color=black,mark=none,fill=black,
fill opacity=0.05] coordinates {
(2., 0)
(2., 1)
(1.25, 1)
(1.25, 0)};
\addplot [thick,color=black,mark=none] coordinates {
(1.25, 0)
(0, 0)};

% add x axis
\draw[ultra thin] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);

\node at (axis cs:1.47,0.5) [anchor=west] {$\heavis$};

% add square representing standard dofs
\addplot [mark=*, mark size=3, mark options={solid, fill=red}] coordinates {
(0, 0)
(2, 0) };

% add x axis
\draw[ultra thin] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);

\end{axis}
\end{tikzpicture}
\end{document}


The 'w' character is here:

and the 'H' character here:

UPDATE Added MWE:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage[]{stix}

\begin{document}
%    \input{cracked_potato.pdf_tex}

\begin{tikzpicture}[scale=1]
\begin{axis}[
xmin=0,xmax=2,ymin=-0.5,ymax=0.5,
xtick={1.25},
xticklabels={$w$},
]
\node at (axis cs:1.47,0) [anchor=west] {$\mathcal{H}$};

\end{axis}
\end{tikzpicture}
\end{document}

• Do you really need all these TikZ pictures to illustrate the problem? Please reduce your code to MWE. Jun 6, 2017 at 15:57
• Remove \usepackage{mathptmx} and do \usepackage{stix}. Jun 6, 2017 at 16:05
• @egreg that didn't work. Jun 6, 2017 at 16:07
• Please, make a minimal example. Jun 6, 2017 at 16:09
• Added the minimal working example showing the right 'H' Jun 6, 2017 at 16:16

## 1 Answer

An H, an H, my kingdom for an H -apologies to Shakespeare

Based on the OP's comment, "I need the 'w' from the first figure above and the 'H' from the second figure", I originally advocated loading mathptmx after loading stix. However, that breaks the minus sign in math mode. So instead, I just load the letters from mathptmx with \DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it}. This line was extracted from mathptmx.sty.

EDIT, per OP comment, to add bm package after the \DeclareSymbolFont invocation.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage[]{stix}
%\usepackage{mathptmx}
\DeclareSymbolFont{letters}     {OML}{ztmcm}{m}{it}
\usepackage{bm}

\begin{document}
%    \input{cracked_potato.pdf_tex}

\begin{tikzpicture}[scale=1]
\begin{axis}[
xmin=0,xmax=2,ymin=-0.5,ymax=0.5,
xtick={1.25},
xticklabels={$-w$},
]
\node at (axis cs:1.47,0) [anchor=west] {$\bm{w}\cdot\mathcal{H}$};

\end{axis}
\end{tikzpicture}
\end{document}


ADDENDUM

In the continued comment discussion below, the OP lamented that getting the mathptmx letters, which was accomplished with

\DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it}


gave also the mathptmx greek symbols, which he did not want. How to recover the stix greeks was the question.

The problem is that greek symbols are classified as "letters" and so changing the letter font changes the greek-symbol font. Thus, I pointed him to my answer at Non italic text in equations, in which a new symbol font is declared, which I call greeksymbols. Then, the greeks are reassigned to that font. Note in the cited answer, various symbols and accents must also necessarily redefined if you wish to use them, because, in general, the slot numbers can vary from font to font for these. So below, in the MWE, I reassign the greeks, but only put placeholders for the symbols and accents, which any user of this method will have to pursue by examining the stix font tables.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage[]{stix}
%\usepackage{mathptmx}
\DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it}
\DeclareSymbolFont{greeksymbols}{LS1}{stix}{m}{it}

\DeclareMathSymbol{\alpha}{\mathord}{greeksymbols}{"0B}
\DeclareMathSymbol{\beta}{\mathord}{greeksymbols}{"0C}
\DeclareMathSymbol{\gamma}{\mathord}{greeksymbols}{"0D}
\DeclareMathSymbol{\delta}{\mathord}{greeksymbols}{"0E}
\DeclareMathSymbol{\epsilon}{\mathord}{greeksymbols}{"0F}
\DeclareMathSymbol{\zeta}{\mathord}{greeksymbols}{"10}
\DeclareMathSymbol{\eta}{\mathord}{greeksymbols}{"11}
\DeclareMathSymbol{\theta}{\mathord}{greeksymbols}{"12}
\DeclareMathSymbol{\iota}{\mathord}{greeksymbols}{"13}
\DeclareMathSymbol{\kappa}{\mathord}{greeksymbols}{"14}
\DeclareMathSymbol{\lambda}{\mathord}{greeksymbols}{"15}
\DeclareMathSymbol{\mu}{\mathord}{greeksymbols}{"16}
\DeclareMathSymbol{\nu}{\mathord}{greeksymbols}{"17}
\DeclareMathSymbol{\xi}{\mathord}{greeksymbols}{"18}
\DeclareMathSymbol{\pi}{\mathord}{greeksymbols}{"19}
\DeclareMathSymbol{\rho}{\mathord}{greeksymbols}{"1A}
\DeclareMathSymbol{\sigma}{\mathord}{greeksymbols}{"1B}
\DeclareMathSymbol{\tau}{\mathord}{greeksymbols}{"1C}
\DeclareMathSymbol{\upsilon}{\mathord}{greeksymbols}{"1D}
\DeclareMathSymbol{\phi}{\mathord}{greeksymbols}{"1E}
\DeclareMathSymbol{\chi}{\mathord}{greeksymbols}{"1F}
\DeclareMathSymbol{\psi}{\mathord}{greeksymbols}{"20}
\DeclareMathSymbol{\omega}{\mathord}{greeksymbols}{"21}
\DeclareMathSymbol{\varepsilon}{\mathord}{greeksymbols}{"22}
\DeclareMathSymbol{\vartheta}{\mathord}{greeksymbols}{"23}
\DeclareMathSymbol{\varpi}{\mathord}{greeksymbols}{"24}
\DeclareMathSymbol{\rho}{\mathord}{greeksymbols}{"25}
\DeclareMathSymbol{\varsigma}{\mathord}{greeksymbols}{"26}
\DeclareMathSymbol{\varphi}{\mathord}{greeksymbols}{"27}
%SYMBOLS
%\DeclareMathSymbol{\<macroname>}{\mathrel}{greeksymbols}{"<slot>}
%OTHERS
%\DeclareMathAccent{\vec}{\mathaccent}{greeksymbols}{"<slot>}

\usepackage{bm}

\begin{document}
%    \input{cracked_potato.pdf_tex}

\begin{tikzpicture}[scale=1]
\begin{axis}[
xmin=0,xmax=2,ymin=-0.5,ymax=0.5,
xtick={1.25},
xticklabels={$-w\chi$},
]
\node at (axis cs:1.47,0) [anchor=west] {$\bm{w}\cdot\mathcal{H}$};

\end{axis}
\end{tikzpicture}
\end{document}


Note the stix \chi, rather than the mathptmx version.

• Comments are not for extended discussion; this conversation has been moved to chat. Jun 12, 2017 at 8:12