mathjax / mathjax/MathJax

Support repeat/logic control for `newcommand` extension

Open
#2,922 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request Good first contribution
Dominant language
JavaScript
Stars
10.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I want to simulate some commands which supported by amsmath package, but without logic control, it won't be possible, so I wonder is there any way to do this, or will you add this feature?

Syntax might like this:

\newcommand\hdotsfor[1]{%
  \foreach \index in {1, ..., #1} {%
   \ifnum\index!=1{$}  \cdots %
  }}

Invoke \hdotsfor{3} will get:
$$
\cdots & \cdots & \cdots
$$

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the newcommand extension and the requested repeat/logic syntax, including the foreach and ifnum example. Done means newcommand definitions can express the shown control flow and invoking hdotsfor{3} produces the expected repeated dots.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.