2

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: enter image description here

and the 'H' character here:

enter image description 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}
aaragon
  • 3,041
  • 1
    Do you really need all these TikZ pictures to illustrate the problem? Please reduce your code to MWE. – Michael Fraiman Jun 06 '17 at 15:57
  • 1
    Remove \usepackage{mathptmx} and do \usepackage{stix}. – egreg Jun 06 '17 at 16:05
  • @egreg that didn't work. – aaragon Jun 06 '17 at 16:07
  • 2
    Please, make a minimal example. – egreg Jun 06 '17 at 16:09
  • Added the minimal working example showing the right 'H' – aaragon Jun 06 '17 at 16:16
  • I still do not understand what you want and your MWE doesn't compile, but try using package unicode-math and setmathfont{STIX Two Math}. Compile with Xe or LuaLaTeX. – Michael Fraiman Jun 06 '17 at 16:21
  • I can't get the 2 characters I want simultaneously. I need the 'w' from the first figure above and the 'H' from the second figure, and I don't understand why with one configuration I get one, and with the other configuration I get the other. – aaragon Jun 06 '17 at 16:23
  • The diagram is quite unrelated to the problem, isn't it? Something like \documentclass{article} \usepackage{mathptmx} \usepackage[notext, nomath, lcgreekalpha]{stix} \begin{document} $w\mathcal{H}$ \end{document} with and without mathptmx seems to be enough. – Torbjørn T. Jun 06 '17 at 16:24
  • @TorbjørnT. it seems so, but I don't know whether the pgfplots influences the result. – aaragon Jun 06 '17 at 16:25
  • I don't see why it would, I don't think pgfplots messes with the fonts. – Torbjørn T. Jun 06 '17 at 16:28
  • the explanation for the shape of the "w" in the stix fonts is this: in order to have a distinct "v" (it is often confused with "nu"), it is made with a rounded bottom; since the "w" is conceptually related to "v", it too is shaped with the rounded bottom. this is traditional with times fonts used for math, where "v" and "w" are substituted from (reportedly) century schoolbook. (sorry this doesn't help with an answer.) – barbara beeton Jun 06 '17 at 18:09

1 Answers1

3

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}

enter image description here


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}

enter image description here

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