1

I want to drawing two arrows which different directions from 1 edge to 2 edge.

I want to print a and b on the arrows respectively.

enter image description here

2

mwe

\documentclass{article}
\usepackage{amssymb}
\usepackage{stackrel}
\begin{document}
$1\stackrel[b]{a}{\rightleftarrows}2$ 
\end{document}
0

An answer with tikz overlays (1 and 2 are not in the tikz picture but could be)

\documentclass[]{article}
\usepackage{tikz}

\newcommand{\tikzmark}[1]{\begin{tikzpicture}[overlay,remember picture]\coordinate(#1);\end{tikzpicture}}

\begin{document}
{\Huge 1\tikzmark{A}\hspace{50pt}\tikzmark{B}2}
\begin{tikzpicture}[overlay,remember picture]
\draw[thick,->] ([shift={(0,0.4)}]A)--([shift={(0,0.4)}]B) node[midway, above]{{\large a}};
\draw[thick,<-] ([shift={(0,0.1)}]A)--([shift={(0,.1)}]B) node[midway, below]{{\large b}};
\end{tikzpicture}
\end{document}

enter image description here

0

it is not clear, if you like to have as math expression (as provide Fran in his nice answer), or you like to have picture with such content. for the latter is handy package tikz-cd (intended for the commutative diagrams):

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
1 \arrow[r,shift left,"a"]
    &
2 \arrow[l,shift left,"b"]
\end{tikzcd}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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