3
$\begingroup$

I have noticed that, if I type \$100%\times x\$, I get $100%\times x$ and not $100\%\times x$.

Does % mean to ignore the following text or something like that?

I didn't find an explanation for the action of % in the MathJax Tutorial.

$\endgroup$
2
  • 3
    $\begingroup$ Note that as with the dollar sign and certain other symbols that have special meaning in MathJax or $\LaTeX$, the literal symbol is most easily produced by "escaping" it, that is prefixing it with a backslash. $\%$ appears as $\%$. $\endgroup$
    – hardmath
    Commented Aug 9, 2019 at 21:36
  • $\begingroup$ Sidenote: % is used for comments on MATLAB as well $\endgroup$ Commented Jul 17, 2020 at 9:51

1 Answer 1

4
$\begingroup$

A % in this context will denote a comment. Similar to HTTP which marks comments using <!-- a comment can go here --> or several programming languages which use slashes such as //a comment can go here or /*a very long comment spanning several lines can go here*/, the percent sign can be used in LaTeX and related typesetting languages such as MathJax to denote that what follows on the same line should not be rendered or executed. Comments can be helpful to help organize or explain certain code to yourself or others who come behind to read the source.

See this related question from tex.stackexchange.com.

Note that what follows on the same line is what is ignored up until an actual newline character, even in the event that you include \\ which would otherwise be interpreted as beginning a new line.

For example

$$a%b c d \\ e f g h i j\\k l m$$

will render as $$a%b c d \\ e f g h i j\\k l m$$

$\endgroup$
7
  • $\begingroup$ Thank you (+1). I understand the concept; I just didn't realize that % is the character to denote a comment $\endgroup$ Commented Aug 7, 2019 at 13:32
  • $\begingroup$ I don't understand why they allow it here. $\endgroup$
    – user645636
    Commented Aug 7, 2019 at 17:26
  • $\begingroup$ @RoddyMacPhee MathJax is used by more than just stackexchange. Are you saying you would rather have a custom version of MathJax that disables that feature, making code harder to maintain, rather than just use the same version of MathJax that everywhere else uses for the sake of disabling a single feature? $\endgroup$
    – JMoravitz
    Commented Aug 7, 2019 at 17:29
  • $\begingroup$ I just don't see much use to the comments except swearing on a site based system. $\endgroup$
    – user645636
    Commented Aug 7, 2019 at 17:31
  • 3
    $\begingroup$ @RoddyMacPhee Why did you delete your post? $\endgroup$
    – TheSimpliFire Mod
    Commented Aug 7, 2019 at 18:42
  • $\begingroup$ I left my last math forum due to being edited to reframe my wording. if they didn't like it I could be downvoted. question asker took it upon themselves to edit my answer. They are a frequent editor of my posts. My only reason for being on this site, at all, come down to social pressure not to give up on math. $\endgroup$
    – user645636
    Commented Aug 7, 2019 at 19:08
  • 3
    $\begingroup$ @RoddyMacPhee that may be deserving of its own meta post, but my opinion is that an edit can (and should) be suggested whenever it actively improves the readability (e.g. formatting, typesetting, grammar,...) while not causing harm or conflicting with the original author's intent. Such an edit should not be taken as an insult and should be taken graciously by the author. If the author disagrees with the edit, they may choose to roll it back as they see fit. $\endgroup$
    – JMoravitz
    Commented Aug 7, 2019 at 19:12

You must log in to answer this question.

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