Skip to content

Provide \to and \mapsto as shortcuts#8

Draft
tobiasdiez wants to merge 1 commit into
astoff:masterfrom
tobiasdiez:patch-1
Draft

Provide \to and \mapsto as shortcuts#8
tobiasdiez wants to merge 1 commit into
astoff:masterfrom
tobiasdiez:patch-1

Conversation

@tobiasdiez

Copy link
Copy Markdown

This PR enables \to and \mapsto as shortcuts for the common latex arrows. Thus, the following works

\begin{tikzcd}
	E \to[r, "L"] & F
	\\
	e \mapsto{r} & L(e).
\end{tikzcd}

Advantages:

  • Consistent with normal equations where \to and \mapsto are used for the arrows
  • Semantic naming

I've marked this as a draft PR, as the following points still need to be done but I wanted to get early feedback:

  • Document these commands
  • Support the new syntax for \mapsto i.e. \mapsto[r] instead of \mapsto{r}. Any advice on how to do this?

@astoff

astoff commented Apr 30, 2020

Copy link
Copy Markdown
Owner

This proposal would break the following, not completely unreasonable construction,

\begin{tikzcd}
A \to B \ar[r] & B \to D
\end{tikzcd}

which I would say is not acceptable.

@tobiasdiez

Copy link
Copy Markdown
Author

You are right, this code would no longer work. But why do you think somebody would use normal arrows (\to) in a commutative diagram?

@astoff

astoff commented May 1, 2020

Copy link
Copy Markdown
Owner

@tobiasdiez For instance, because some arrows don't need a label and/or should be shorter. I'm not saying it's the best (or even a good) way to do it, but it's something some people will do, with really confusing results. Consider also the possibility that an object of the diagram is A_\to, or the user in the habit of writing \overset\to v instead of \vec v; or even the possibility that some command defined in terms of \to or \mapsto is used inside {tikzcd}.

This change would make the package's behaviour less predictable.

@tobiasdiez

Copy link
Copy Markdown
Author

Ok, I understand. These examples feel a bit artificial to me, but I also see that as a package maintainer you have to consider these edge cases.

Would you consider adding a package option, that enables the to shortcut or do you think it's really not something for this package? (Both would be fine for me of course. With my two recent PRs I just thought about contributing back some of my changes that I implemented to make my life easier.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants