Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature proposal] Left aligned stackrel #37

Open
FelixBenning opened this issue Mar 9, 2022 · 4 comments
Open

[Feature proposal] Left aligned stackrel #37

FelixBenning opened this issue Mar 9, 2022 · 4 comments

Comments

@FelixBenning
Copy link

The following

\documentclass{article}
\usepackage{mathtools}
\begin{document}
    \begin{align}
    	&\text{First Statement}\\
    	&\implies \text{Second Statement}\\
    	&\stackrel{\text{Explanation}}{\implies}\text{Third Statement}\\
        &\stackrel{\mathclap{\text{Explanation}}}{\implies} \text{Fourth Statement}
\end{align}
\end{document}

compiles to

misaligned implications

The solution I ended up building for this looks like this:

\newcommand*{\lstackrel}[2]{ %uses leftsides smashoperator thus ignoring overlap towards the left
        \mathrel{% makes the resulting stack a relation class (like =,<,>,...)
		\smashoperator[l]{\mathop{#2}^{#1}}
        }
}% use when aligning to the left

where \lstackrel{\text{explanation}}{=} aligns the equal sign towards the left.

@zauguin
Copy link
Member

zauguin commented Mar 9, 2022

You can use the aligned-overset package for this which also ensures that it never overlaps with any potential content on the left:

\documentclass{article}
\usepackage{aligned-overset}
\begin{document}
\begin{align}
  &\text{First Statement}\\
  &\implies \text{Second Statement}\\
  \overset{\text{Explanation}}&{\implies} \text{Third Statement}\\
  \overset{\text{Explanation}}&{\implies} \text{Fourth Statement}
\end{align}
\end{document}

@blefloch
Copy link
Member

blefloch commented Mar 9, 2022

Amazing! Could this relatively unknown package become part of mathtools, or perhaps be mentioned in the documentation?

@zauguin
Copy link
Member

zauguin commented Mar 26, 2022

@blefloch Sorry, I missed your comment. I wouldn't mind merging it into mathtools if @daleif is happy with that.

@daleif
Copy link
Collaborator

daleif commented Mar 28, 2022

I think the only problem about a merge is that even thoug it might seem so, mathtools is not written in expl3 (Morten made a self contained variant of it before expl3 was consolitated or something like that).

I'm currently unsure as to which direction to go with mathtools, either convert it into expl3 (which can cause issues for those who update manually), or leave it as it is now (I'm not particularly well versed in expl3 programming, or Mortens setup for that matter)

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

No branches or pull requests

4 participants