1

I would like to show, in my latex document, some in-text arrows similar to the ones in the attached figure. I know about the \leftrightarrow and \updownarrow commands, but I don't know how to combine them, nor how to rotate them. Is tikz necessary to achieve this?

enter image description here

Any help will be much appreciated.

EDIT: I clarify better, I'm sorry if my question was unclear. I would like to avoid math mode (but it's not important) and tikz as well (to avoid loading too many packages), but having a look around it seems that tikz is necessary to do it. In the end, I'd like to have something like A \to B but with the symbols I described.

For future reference, my question would be similar to this one.

Enzo
  • 153
  • 1
    In math mode instead of a normal arrow? – CarLaTeX Nov 23 '17 at 14:02
  • Hi, I explained it better in the question, I'd like it in text if it's possible, not in math mode or as an external image. – Enzo Nov 23 '17 at 16:48
  • Loading an external image is likely to be at least as slow as loading a package! egreg's solution below may be what you want. –  Nov 23 '17 at 19:29

2 Answers2

3

It would be nice if the question gave a little more information about the context and how this would be used. As \leftrightarrow and \updownarrow are explicitly mentioned I assume that these arrows are meant to be a similar binary relation you could use in math-mode. One option is to use tikz as follows:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{
  % define default style for the arrows
  myarrows/.style={scale=0.25,
                   baseline=(current bounding box.south),
                   >={Latex[length=2pt]},
                   <->
  }
}

\newcommand\biarrow[1][]{\mathbin{\tikz[myarrows,#1]{
      \draw(0,0.5)--++(1,0);\draw(0.5,0)--++(0,1);
}}}
\newcommand\diarrow[1][]{\mathbin{\tikz[myarrows,#1]{
      \draw(0,0)--(1,1);\draw(0,1)--(1,0);
}}}

\begin{document}

  $A \biarrow B$

  $A \diarrow[blue] B$

  $A \diarrow[densely dotted, xscale=3] B$

\end{document}

This code produces:

enter image description here

The the code defines two macros, \biarrow and \diarrow, that use \tikz{...} to draw the arrows. The macros accept an optional argument that can be used to apply tikz styling, as in the second and third examples above. I have using \tikzset to define common styling for both macros.

If it is going to be used in superscripts and subscripts etc then this should be defined using \mathpalette; see The mysteries of \mathpalette

Edit

If you don't want to use these in math-mode then the macros become simpler as you can drop the \mathbin:

\newcommand\biarrow[1][]{\tikz[myarrows,#1]{
      \draw(0,0.5)--++(1,0);\draw(0.5,0)--++(0,1);
}}
\newcommand\diarrow[1][]{\tikz[myarrows,#1]{
      \draw(0,0)--(1,1);\draw(0,1)--(1,0);
}}
  • Thanks for your answer. I was actually trying not to use math mode, as I'd need them in-text, but I think I was misleading when I made those examples, I'm sorry about it. However, it looks like tikz would be the only acceptable solution, even in math mode I don't think there are symbols like those, right? – Enzo Nov 23 '17 at 16:51
  • This is why you should always give a minimal working example with questions: a MWE makes it much clearer what you asking for. Using http://detexify.kirelabs.org/classify.html suggests that these arrows do not exist "natively" in latex, but perhaps you can find one of them in a symbol font (try searching through the PDF file that appears when you type texdoc symbols-a4 from the command-line). I'll edit to give non-math-mode versions. –  Nov 23 '17 at 17:13
  • I added a reference to another similar question, in case anyone has a similar problem. – Enzo Nov 24 '17 at 10:40
3

Superimposing arrows

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\arrowtimes}{\mathrel{\mathpalette\enzo@arrowtimes\relax}}
\newcommand{\enzo@arrowtimes}[2]{%
  \ooalign{%
    $\m@th#1\nwarrow$\cr
    $\m@th#1\swarrow$\cr
    $\m@th#1\nearrow$\cr
    $\m@th#1\searrow$\cr
  }%
}
\newcommand{\arrowplus}{\mathrel{\mathpalette\enzo@arrowplus\relax}}
\newcommand{\enzo@arrowplus}[2]{%
  \ooalign{%
    $\m@th#1\leftarrow\mathrel{\mspace{-9mu}}\rightarrow$\cr
    \hidewidth$\m@th#1\text{$\m@th\big\uparrow$}$\hidewidth\cr
    \hidewidth$\m@th#1\text{$\m@th\big\downarrow$}$\hidewidth\cr
  }%
}
\makeatother

\begin{document}

\[
A \arrowtimes B_{x\arrowtimes y}
\qquad
A \arrowplus B_{x\arrowplus y}
\]

\end{document}

enter image description here

With less prominent arrow heads and just for text mode, with mathabx arrows.

\documentclass{article}

\DeclareFontFamily{U}{abxarrows}{}
\DeclareFontShape{U}{abxarrows}{m}{n}{
  <-5.5> matha5
  <5.5-6.5> matha6
  <6.5-7.5> matha7
  <7.5-8.5> matha8
  <8.5-9.5> matha9
  <9.5-11> matha10
  <11-> matha12
}{}
% left="D0
% right="D1
% up="D2
% down="D3
% nw="D4
% ne="D5
% sw="D6
% se="D7

\newcommand{\timesarrows}{%
  \raisebox{0.5\depth}{%
    \usefont{U}{abxarrows}{m}{n}%
    \ooalign{%
      \symbol{"D4}\cr
      \symbol{"D5}\cr
      \symbol{"D6}\cr
      \symbol{"D7}\cr
    }%
  }%
}
\newcommand{\plusarrows}{%
  \raisebox{0.5\depth}{%
    \usefont{U}{abxarrows}{m}{n}%
    \ooalign{%
      \hidewidth\symbol{"D2}\hidewidth\cr
      \symbol{"D0}\cr
      \symbol{"D1}\cr
      \hidewidth\symbol{"D3}\hidewidth\cr
    }%
  }%
}

\begin{document}

X\timesarrows Y\plusarrows Z

\end{document}

enter image description here

egreg
  • 1,121,712
  • Thank you very much, I guess math mode is not that big of an issue after all, it was just a whim of mine. Would it be possible to "straighten" the arrow heads? – Enzo Nov 24 '17 at 10:42
  • @Enzo I added as per your request – egreg Nov 24 '17 at 11:34