# Arrow between two baselines

Consider the following MWE:

\documentclass[a4paper,12pt]{article}

\def\texttext{This is a sample text}
\newlength{\textlength}
\settowidth{\textlength}{\texttext}

\begin{document}
\thispagestyle{empty}

\rule{5pt}{.1pt}\rule{\textlength}{.1pt}\kern-\textlength \texttext\rule{5pt}{.1pt}

\rule{5pt}{.1pt}\rule{\textlength}{.1pt}\kern-\textlength \texttext\rule{5pt}{.1pt}

\end{document}


I want to draw an two-headed arrow between the baselines. Doubtless this is possible with TikZ, but can it also be done in plain Latex.

• At which point? Beginning of lines? End? – Bernard Sep 5 '18 at 12:35
• Of course it can, after all TikZ is implemented in TeX. Why do you want to do that though? – Skillmon likes topanswers.xyz Sep 5 '18 at 12:42
• @bernard At the end. – Jesse op den Brouw Sep 5 '18 at 12:50
• @Skillmon. Just for fun. – Jesse op den Brouw Sep 5 '18 at 12:51
• @Skillmon - Most of what TikZ does goes straight to the PDF driver. – John Kormylo Sep 5 '18 at 13:03

Here a solution (with trial and errors):

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath, amssymb, old-arrows}
\usepackage{graphicx}

\def\texttext{This is a sample text}
\newlength{\textlength}
\settowidth{\textlength}{\texttext}

\makeatletter
\newcommand\xleftrightarrow[2][]{%
\ext@arrow 9999{\longleftrightarrowfill@}{#1}{#2}}
\newcommand\longleftrightarrowfill@{%
\arrowfill@\leftarrow\relbar\rightarrow}
\makeatother

\begin{document}
\thispagestyle{empty}

\rule{5pt}{.1pt}\rule{\textlength}{.1pt}\kern-\textlength \texttext\rule{5pt}{.1pt}\raisebox{-0.62ex}[0pt][0pt]{ \rotatebox[origin=l]{-90}{$\xleftrightarrow{\makebox[1.44ex]{}}$}}

\rule{5pt}{.1pt}\rule{\textlength}{.1pt}\kern-\textlength \texttext\rule{5pt}{.1pt}

\end{document}


I take it \resizebox would be cheating?

\documentclass[a4paper,12pt]{article}

\def\texttext{This is a sample text}
\newlength{\textlength}
\settowidth{\textlength}{\texttext}

\newcommand{\clap}[1]{\bgroup
\sbox0{#1}%
\hspace{-0.5\wd0}\usebox0\hspace{-0.5\wd0}%
\egroup}

\begin{document}
\thispagestyle{empty}

\rule{5pt}{.1pt}\rule{\textlength}{.1pt}\kern-\textlength \texttext\rule{5pt}{.1pt}

\rule{5pt}{.1pt}\rule{\textlength}{.1pt}\kern-\textlength \texttext\rule{5pt}{.1pt}%
\clap{\raisebox{\depth}[0pt]{\large$\updownarrow$}}

\end{document}


• Would it be cheating? – Jesse op den Brouw Sep 5 '18 at 13:26
• Like TikZ, graphics goes straight to the PDF driver. Except for pict2e (which uses specialized fonts) TeX has no graphics capability. – John Kormylo Sep 5 '18 at 13:28