1

I have two compounded question.

I'm looking for a math symbol to represent an edge between two variables without an arrowhead. For example,

$$Z \leftarrow X <SYMBOL> Y$$

I can't use either \leftarrow or \rightarrow, as I don't know where the arrow is, so I'd use a simple line (I don't know which symbol to use that has a similar length to `\leftarrow). Also, I want a question mark on top of that line.

I've tried with $\stackrel{?}{-}$, but - is too short and \stackrel{?} puts the question mark too far above, increasing line height unnecessarily.

Any ideas?

2
  • 1
    This sounds more like a diagram than a mathematical expression. have you looked at the tikz-cd package? It can easily make "edges" with no arrowhead.
    – daleif
    Sep 29, 2022 at 10:13
  • I use tikzpicture for modelling more complex graphs, but this is for inline equations describing certain paths along the graph. Sep 29, 2022 at 10:20

2 Answers 2

1

Here is a possibility with tikzcd:

enter image description here

\documentclass{article}

\usepackage{tikz-cd}

\newcommand{\myarrow}[1][-]{\begin{tikzcd}[ampersand replacement=\&, sep=small, cramped]{}\arrow[r,#1]\&{}\end{tikzcd}}

\begin{document}
Here $A \myarrow[<-] B \myarrow C \myarrow[-,"?"] D$ is an inline expression.
\end{document}

If you want to make sure the surrounding spacing is unaffected, use \smash:

$A \myarrow[<-] B \myarrow C \myarrow[-,"\smash{?}"] D$

enter image description here

You can use any arrow attributes allowed by tikzcd, for example:

enter image description here

$A \myarrow[-, "?"{description, inner sep=0}] 
 B \myarrow[-, "\scriptstyle ?"marking]
 C \myarrow[-, "\smash{?}"] 
 D \myarrow[-, "?"', red, bend left, shorten >=2pt, shorten <=2pt] 
 E$
1

Define your own \xedge command modelled on \xrightarrow.

Not that easy, though.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\DeclareRobustCommand{\xedge}[2][]{\ext@arrow 3399\edgefill@{#1}{#2}}
\newcommand\edgefill@{\arrowfill@\relbar\relbar\higherrelbar}
\newcommand{\higherrelbar}{\mathrel{\vphantom{\to}}\relbar}
\makeatother

\begin{document}

\[
Z \xedge[?]{?} X \xrightarrow[?]{?} Y
\]
\[
Z \xedge{a+b-c} X
\]

\end{document}

enter image description here

You must log in to answer this question.

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