Add support for `\vspace` command
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
MathJax currently lacks support for the \vspace command. This makes it difficult to adjust vertical spacing in equations, particularly for negative spacing. While \hspace is supported, there's no direct equivalent for vertical space.
For example, consider trying to create a diagram, such as:
\begin{align}
\hspace{4cm} Y \\
\hspace{4cm} \rule{0.1em}{2cm} \\
% \vspace{-1em}
X \hspace{0.2em} \rule{3.5cm}{0.1em}
\end{align}
$$
\begin{align}
\hspace{4cm} Y \
\hspace{4cm} \rule{0.1em}{2cm} \
% \vspace{-1em}
X \hspace{0.2em} \rule{3.7cm}{0.1em}
\end{align}
$$
Without \vspace, it is impossible to introduce the desired negative vertical spacing.
Describe the solution you'd like
Add support for the \vspace command in MathJax, allowing users to add vertical space (both positive and negative) using syntax like \vspace{1em} or \vspace{-1em}.
Describe alternatives you've considered
The workaround \rule{0pt}{#1em} can add positive vertical space but cannot create negative vertical space.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named in the issue. Start by tracing the existing \hspace command in MathJax and compare its behavior with the requested \vspace{1em} and \vspace{-1em} cases; done means both positive and negative vertical spacing work in the shown align example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, latex
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100