LaTeX Mastering LaTeX Equations: A Comprehensive Guide for Beginners on Physics Forums

  • Thread starter Thread starter Redbelly98
  • Start date Start date
Click For Summary
The discussion focuses on improving the LaTeX guide for beginners on Physics Forums, emphasizing the need for updated resources and clearer explanations. Participants suggest starting with basic instructions for posting simple equations using [itex] and [tex] tags, and then progressing to more complex topics like matrices and multi-line code. Key issues include addressing the 50-character bug that disrupts LaTeX formatting and clarifying the differences between itex and tex tags. There is also a call for better documentation, including a comprehensive symbol list and clearer examples of LaTeX usage. Overall, the thread aims to enhance the learning experience for users new to LaTeX.
  • #61


Great. I like the thread title. Perhaps just "Getting started" would sound a little bit better than "Getting started for newbies"?

Small mistake: I wrote
\ or ~ (followed by a space) inserts a space​
but you don't have to type a space after ~. The codes are "\ " and "~". So for example
\ (followed by a space) or ~ inserts a space​
would be better.
 
Physics news on Phys.org
  • #62


Good idea, Fredrik, I have made both changes.
 
  • #63


Found another mistake:
A matrix can easily by typed by the matrix, pmatrix, bmatrix and vmatrix environments.​
Should be something like
A matrix can easily be typed using the matrix, pmatrix, bmatrix or vmatrix environments.​

It looks like I somehow forgot to make the following change when I was doing some edits earlier:
Fredrik said:
I want to change
So you don't have to type any line breaks before the opening tex tag or after the closing tex tag. The following example illustrates these ideas.​
to
So you don't have to type any line breaks before the opening tex tag or after the closing tex tag. However, you can type a single line break before a tex tag without changing the output. The following example illustrates these ideas.​
I still want to make that change. But there's obviously no hurry.
 
  • #64


Fredrik said:
That would have to be the table. However, I'm also using Firefox, and when I change the window size to one that's just large enough to get rid of the horizontal scrollbar, the window is a bit smaller than I usually keep it. It's too small to display the right edge of the box with greek letters and other symbols that you see in advanced edit mode.

Are you using some special feature, like "scale all math to 150%"?
No; also, other threads looked fine.
Everything looks good now that I'm reading it on my computer at home, however.
Thanks for putting this together. It is well done and very useful!
 
  • #65


Fredrik said:
[Suggested a couple of changes]
Done.
marcusl said:
Thanks for putting this together. It is well done and very useful!
Agreed!
 
  • #66


Two more suggestions: We're talking about how to display something like "f(x) if x>0". I think it should say something like "f(x)=0 if x>0" instead. (Make sure to change it in all 8 places).

The sentence
This can be done by typing \left and \right in front of the delimiter.​
should be
This can be done by typing \left and \right in front of the delimiters.​
or
This can be done by typing \left or \right in front of the delimiter.​
Hm, my first thought was to choose the first option because it reinforces the idea that you need both a left and a right. However, from a language nazi's perspective, I think the second option is better, because the first one is actually saying that you should type stuff like \left\right(. This is of course harmless because of the example that clarifies what the sentence means. But the fact that the second option doesn't reinforce that you need both a left and a right is also harmless, since it's explicitly stated in the next paragraph.

I'll let you choose. :smile:
 
  • #67


Changes made. (I went with "...\left or \right...")
 
  • #68
There was an error in the table - \leftrightarrow was shown in the right column, but it was not present in the left column. Corrected.
 
  • #69
We should add something about simplified tags. Something like
Simplified tags: Instead of typing [itеx] and [/itеx], you can type #_# and #_#. Instead of typing [tеx] and [/tеx], you can type $_$ and $_$.​
but obviously without the _ characters. I don't see a way to type ## twice without everything between them getting interpreted as LaTeX code. Code tags would work of course, but it's kind of ugly. Anyone see a better way?
 
  • #70
This works (with the spaces deleted), but it makes IE8 run unbelievably slow, unless something else is causing that right now.

[ FONT = "Verdana" ] # # [ / FONT ]
 
Last edited:
  • #71
Oops, duplicate post, but there doesn't seem to be a "delete" button in this subforum.
 
  • #72
AlephZero said:
This works (with the spaces deleted), but it makes IE8 run unbelievably slow, unless something else is causing that right now.
Thanks. That works without any slowness in Firefox. Let me know if the slowness was just a temporary issue.
 
  • #73
FYI, new MathJax will be out soon. Here are the improvements:

New Features in MathJax v2.0:

• Major speed improvement for HTML-CSS output, particularly in IE:

The HTML-CSS output processing was redesigned to avoid the page reflows that were the main source of the speed problem in Internet Explorer 8 and 9. For test pages having between 20 and 50 expressions, we see an 80% reduction in output processing time for IE8, a 50% reduction for IE9, and between 15% and 25% reduction for most other browsers over the v1.1a times. Since the processing time in v1.1a grows non-linearly in IE, you should see even larger savings for pages with more equations when using v2.0. Forcing IE7 emulation mode is no longer necessary (and indeed is no longer recommended).

• Reduced flickering during typsetting:

In the past, each expression was displayed as soon as it was typeset, which caused a lot of visual flickering as MathJax processed the page. In v2.0, the output is processed in blocks so that typeset expressions are revealed in groups. This reduces the visual distraction, and also speeds up the processing. The number of equations in a block can be controlled through the EqnChunk parameter in the HTML-CSS block of your configuration. See config/default.js for details.

If the page URL includes a hash reference (a link to a particular location within the page), MathJax v2.0 will jump to that location after the page has finished typsetting. (Since the size of the page may have changed due to the mathematical typsetting, that location may no longer be visible on screen, so MathJax moves there when it is done with the initial typesetting.) You can control this behavior with the positionToHash parameter in the main section of your configuration.

• Automatic equation numbering of TeX formulas:

The TeX input jax now can be configured to add equation numbers (though the default is not to number equations so that existing pages will not change their appearance). This is controlled through the equationNumbers section of the TeX block of your configuration (see config/default.js for details). You can request that the numbering follow the AMS-style numbering of environments, or you can request that every displayed equation be numbered. There are now \label, \ref, and \eqref commands to make it easier to link to particular equations within the document.

• Automatic line breaking of long displayed equations:

MathJax now implements the MathML3 specification for automatic line breaking of displayed equations in its HTML-CSS output. This is disabled by default, but can be enabled via the linebreaks section of the HTML-CSS block of your configuration (see config/default.js for details).

• New AsciiMath input jax and SVG output jax:

MathJax currently processes math in either TeX/LaTeX format, or MathML notation; version 2.0 augments that to include ASCIIMathML notation (see http://www1.chapman.edu/~jipsen/mathml/asciimath.html for details on this format). This is a notation that is easier for students to use than TeX, and has been requested by the user community.

In addition to the HTML-CSS and Native MathML output available in v1.1, MathJax v2.0 includes an SVG-based output jax. This should prove to be more reliable than the HTML-CSS output, as it avoids some CSS, web-font, and printing issues that the HTML-CSS output suffers from, and it currently has no browser-dependent code. The SVG mode even works in some ebook readers (like Apple iBooks and Calibre).

• New combined configuration files:

Pre-defined configuration files that include the AsciiMath and SVG processors are now available with MathJax v2.0.

• MathJax contextual menu now available on mobile devices:

MathJax v2.0 provides access to its contextual menu in mobile devices that are based on the WebKit (Safari) and Gecko (Firefox) engines. For Mobile Firefox, the menu is accessed by a tap-and-hold on any expression rendered by MathJax (this is Mobile Firefox's standard method of triggering a contextual menu). In Mobile Safari, use a double-tap-and-hold. This is the first step toward providing a better interface for mobile devices.

• Improved support for screen readers:

Some issues surrounding the use of screen readers and their interaction with MathPlayer have been resolved in MathJax v2.0. In particular, there are additional menu items that allow the user finer control over some aspects of MathJax's interface that were interfering with some screen readers' ability to properly identify the mathematics. Several stability issues with MathPlayer have also been addressed.

• Many new TeX additions and enhancements:

• New mhchem chemistry extension (adds \ce, \cf, and \cee macros)
• New cancel extension (adds \cancel, \bcancel, and \cancelto macros)
• New extpfeil extension (adds more stretchy arrows)
• New color extension (makes \color work as a switch, as in LaTeX). Adds \definecolor, other color models, LaTeX named colors, \colorbox, \fcolorbox, etc.
• New begingroup extension to allow macro definitions to be localized. Adds \begingroup, \endgroup, \let, \renewenvironment, \global, and \gdef.
• New enclose extension to give TeX access to <menclose> elements. Adds \enclose{type}[attributes]{math} macro.
• New action extension to give TeX access to <maction> elements. Adds \mathtip{math}{tip}, \texttip{math}{tip}, and \toggle{math1}{math2}...\endtoggle macros.
• New \mmToken{type}[attributes]{text} macro for producing <mo>, <mi>, <mtext>, and other token MathML elements.
• New \bbox[color;attributes]{math} macro to add background color, padding, borders, etc.
• New \middle macro for stretchy delimiters between \left and \right.
• New \label, \ref, and \eqref macros for numbered equations.
• Better implementation of \not so it produces proper MathML when possible.
• Better implementation of \dots that selects \ldots or \cdots depending on the context.
• Better implementation of \cases that automatically uses \text on the second entry in each row.
• Safer implementation of \require that only allows loading from extensions directory.
• Allow \newcomand to provide a default parameter.
• Allow \\ to take an optional argument that specifies additional space between lines.
• Allow \\ to be used anywhere (to force a line break), not just in arrays.
• Allow optional alignment parameter for array, aligned, and gathered environments.

• Font enhancements:

• Work around for the OS X Lion STIX font problem.
• Support for STIX-1.1-beta fonts (detection of which version you have, and use data appropriate for that).
• New WOFF versions of the web fonts (smaller, so faster to download).
• Data for more stretchy characters in HTML-CSS output.
• Add support for Unicode planes 1 through 10 (not just the Math Alphabet block) in HTML-CSS output.
• Increased timeout for web fonts (since it was switching to image fonts too often, especially for mobile devices).
• Only switch to image fonts if the first web font fails to load (if we can access one, assume we can access them all).
• Allow <mtext> elements to use the page font rather than MathJax fonts (optionally).
• Provide better control over font used for characters that are not in the MathJax fonts.

• Interface improvements:

• The MathJax contextual menu has been reorganized to make it easier to get the source view, and to control the parameters for MathPlayer in IE.
• The MathJax contextual menu is available in mobile devices (see description above).
• Warning messages are issued if you switch renderers to one that is inappropriate for your browser.
• MathJax now starts processing the page on the DOMContentLoaded event rather than the onload event (this allows the mathematics to appear sooner).
• Native MathML output is now scaled to better match the surrounding font.
• Better CSS styling for NativeMML output in Firefox in order to handle \cal and other fonts.
• MathML output now (optionally) includes class names to help mark special situations generated by the TeX input jax. (This let's the MathML from the Show Source menu item better reproduce the original TeX output.)


• Important changes from previous versions:

• The default renderer for Firefox has been changed from NativeMML to HTML-CSS (in those configurations that choose between the two). The only browser that defaults to NativeMML is now IE with MathPlayer installed.

• NativeMML will now be selected in IE9 when MathPlayer is present (since IE9 was released the same day as MathJax v1.1a, and there had been problems with IE9 beta releases, we weren't sure if MathPlayer would work with the official release, and so did not select NativeMML by default.)

• The tex2jax preprocessor now balances braces when looking for the closing math delimiter. That allows expressions like $y = x^2 \hbox{ when $x > 2$}$ to be properly parsed as a single math expression rather than two separate ones with unbalanced braces. The old behavior can be obtained by setting balanceBraces to false in the tex2jax block of your configuration.

• A one pixel padding has been added above and below HTML-CSS output so that math on successive lines of a paragraph won't bump into each other.

• There is a new MathPlayer submenu of the Math Settings menu in the MathJax contextual menu that allows the user to control what events are passed on to MathPlayer. This allows better control for those using assistive devices like screen readers. When menu events are being passed on to MathPlayer, the MathJax menu can be obtained by ALT-clicking on a typeset expression (so the user can still access MathJax's other features).
 
  • #74
Is it ok for everybody if I add this text:

Simplified tags: Instead of typing [itеx] and [/itеx], you can type ## and ##. Instead of typing [tеx] and [/tеx], you can type $$ and $$.

For example

Code:
The equation ##x+2=3## implies $$x=1.$$

Will yield:

The equation ##x+2=3## implies $$x=1.$$

Any comments?
 
  • #75
Looks good to me. (And I don't think the slowness that AlephZero experienced can have been caused by the use of the Verdana font).
 
  • #76
At the very beginning of the FAQ we have this statement:

The easiest way to learn LaTeX is to see what others have done. If you see a post with a nice equation in it, just click QUOTE (at the bottom of the post) to see what the author did.

But it is enough to right click on the equation and select Show Source from the local menu.
 
  • #77
Borek said:
But it is enough to right click on the equation and select Show Source from the local menu.
I prefer the statement we have, because when they click QUOTE they also see what tags we used, and if we typed spaces or newlines before or after. And the right-click thing is explained at the end, under "additional information", where we say "A right-click will display a menu where you can choose to" followed by a list where the first item is "view the LaTeX source code".

Also, this is rarely an issue, but if a person used a \newcommand in his first latex formula in the post, and then used the new command in the second, someone who just looks at the source code won't see the code that defines the code he sees. (I would recommend against using \newcommand like that, because if someone quotes a formula where the command is used but not defined, on a different page of the thread, then (I assume) that the formula won't be displayed correctly. If you want to use \newcommand, I recommend including the definition with every formula that uses it.)
 
Last edited:
  • #78
Borek said:
But it is enough to right click on the equation and select Show Source from the local menu.
If you want to see the code for several different equations, it's easier to use the Quote method.
 
  • #79
FYI, I have edited post #1 of this thread to contain a link to the publicly viewable FAQ thread.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 13 ·
Replies
13
Views
619
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
Replies
3
Views
3K
  • · Replies 766 ·
26
Replies
766
Views
739K
  • · Replies 161 ·
6
Replies
161
Views
5K
  • · Replies 11 ·
Replies
11
Views
146K
  • Sticky
  • · Replies 0 ·
Replies
0
Views
8K