4

I want to import two math symbols from stix2 package: \rdiagovfdiag and \fdiagovrdiag which look like this:

enter image description here

I want to do this, because adding the whole package changes style of my article which I don't like. I've seen in different posts (e.g. here) that it is possible, but I don't know how to modify these examples in my situation.

3
  • 1
    Welcome to TeX.SE.
    – Mico
    Commented Nov 10, 2023 at 21:06
  • In case my answer below does not solve your problem (i.e., the style of your article is still affected), you need to be a bit more specific: Provide a small document where one can observe the style change.
    – gernot
    Commented Nov 10, 2023 at 21:15
  • 2
    This might be helpful: Importing a single symbol from a different font Commented Nov 10, 2023 at 21:19

2 Answers 2

8

The idea is to make a copy of stix2.sty, search for the lines that define the two symbols, delete everything after these lines, and then going backwards to retain only those lines that are needed for defining the symbols.

Save the following lines in a file mystix2.sty.

\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{mystix2}[2023/11/10 pick X symbols from stix2.sty]
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix2}{m}{n}
\DeclareSymbolFont{arrows2}       {LS1}{stix2sf}   {m}{it}
\SetSymbolFont{arrows2}     {bold}{LS1}{stix2sf}   {b}{it}
\def\stix@undefine#1{%
    \if\relax\noexpand#1\let#1=\@undefined\fi}
\def\stix@MathSymbol#1#2#3#4{%
    \stix@undefine#1%
    \DeclareMathSymbol{#1}{#2}{#3}{#4}}
\stix@MathSymbol{\rdiagovfdiag}{\mathord}{arrows2}{"C4}
\stix@MathSymbol{\fdiagovrdiag}{\mathord}{arrows2}{"C5}
\endinput

Use it like in the following sample document.

\documentclass{article}
\usepackage{mystix2}
\begin{document}
$\rdiagovfdiag$ $\fdiagovrdiag$
\end{document}

enter image description here

0
4

You need no package, actually.

The idea is to look how the commands are defined in stix2.sty and you find

\stix@MathSymbol{\rdiagovfdiag}{\mathord}{arrows2}{"C4}
\stix@MathSymbol{\fdiagovrdiag}{\mathord}{arrows2}{"C5}

OK, now we want to see what arrow2 points to:

\DeclareSymbolFont{arrows2}       {LS1}{stix2sf}   {m}{it}
\SetSymbolFont{arrows2}     {bold}{LS1}{stix2sf}   {b}{it}

We have to look for LS1, which is a nonstandard encoding:

\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix2}{m}{n}

OK, we have all the ingredients. I add a prefix just to be sure that nothing gets clobbered.

\documentclass{article}
\usepackage{amsmath}

\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix2}{m}{n}
\DeclareSymbolFont{STIX2arrows2}{LS1}{stix2sf}{m}{it}
\SetSymbolFont{STIX2arrows2}{bold}{LS1}{stix2sf}{b}{it}

\DeclareMathSymbol{\rdiagovfdiag}{\mathord}{STIX2arrows2}{"C4}
\DeclareMathSymbol{\fdiagovrdiag}{\mathord}{STIX2arrows2}{"C5}

\begin{document}

$A\rdiagovfdiag\fdiagovrdiag B$

\end{document}

enter image description here

If you don't need the bold version, you can even avoid wasting a math group:

\documentclass{article}
\usepackage{amsmath}

\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix2}{m}{n}

\NewDocumentCommand{\rdiagovfdiag}{}{\text{\usefont{LS1}{stix2sf}{m}{it}\symbol{"C4}}}
\NewDocumentCommand{\fdiagovrdiag}{}{\text{\usefont{LS1}{stix2sf}{m}{it}\symbol{"C5}}}

\begin{document}

$A\rdiagovfdiag\fdiagovrdiag B$

\end{document}

You must log in to answer this question.

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