0

I've recently converted to using \[ \] instead of $$ $$ as my begin/end math command since I read that is the "correct" method. However, the backslash character is near my pinky on my keyboard and typing that every single line is getting my pinky fatigued.

Is there some sort of multiline equation command/environment in LaTeX similar to how many programming languages have multiline comments?

That is, I currently have:

\[ r \approx R_{\odot}/2 \]
\[ T \approx 10^{7} K \]
\[ M \approx \frac{1}{2} M_{\odot} \]
\[ l \approx R_{\odot}/20 \]
\[ H = \frac{L_{\odot}}{4 \pi r^{2}} \]
\[ \Delta \nabla T \approx 2 \times 10^{-10} \]
\[ \frac{dT}{dr} \approx \frac{\bar{T}}{R_{\odot}} \approx 6 \times 10^{-5} \]

whereas I would like something of the form

\begin{math}
r \approx R_{\odot}/2
T \approx 10^{7} K
M \approx \frac{1}{2} M_{\odot}
l \approx R_{\odot}/20
H = \frac{L_{\odot}}{4 \pi r^{2}}
\Delta \nabla T \approx 2 \times 10^{-10}
\frac{dT}{dr} \approx \frac{\bar{T}}{R_{\odot}} \approx 6 \times 10^{-5}
\end{math}

Please note that amsmath's align and gather don't fit the bill for me since they require two backslashes at the end of each line.

I'm open to source modification solutions.

Also, I'm using the article documentclass (if it matters).

  • 1
    you should never have two display math environments in succession so your first example with multiple ..\]\[... is wrong. It would in theory be possible (but fragile) to make end of line mean \\ in an align but why??? it is only one character less, and you are already entering dozens of \ so \\ is possibly the easiest command to enter. – David Carlisle Mar 6 '16 at 17:50
  • 1
    Well, you have to use your pinky for basically any TeX command -- ;-) – user31729 Mar 6 '16 at 17:50
  • @DavidCarlisle I don't understand what you mean by the first sentence of your comment; it compiles fine for me. It's true you need \ for all the commands but I still think a reduction in the number I have to enter would be nice (and it would remove 4 characters per line, not one). Your mention of modifying align to make end of line mean \\ is essentially what I was thinking of by "open to source modification solutions;" I just wanted to see if people suggested anything different. – Ryan Farber Mar 6 '16 at 19:17
  • 1
    multiple \[\]\[\] does not generate a tex error but the vertical space and page break control around the math will be very poor. using a newline instead of \\ to force a new row in the math does save exactly one character, not four:-) – David Carlisle Mar 6 '16 at 19:25
  • Okay, I think I understand what you mean about the multiple \[ \] issue (though I don't think I've had trouble with it yet). Also, I had meant a "return" will save me four characters in terms of getting rid of the \[ \] on each line. Also, since that newline is there no matter what I still think it would save me two characters rather than one in terms of replacing \\ – Ryan Farber Mar 6 '16 at 21:00
1

I think gathered can help you

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}
    \begin{gathered}
        r \approx R_{\odot}/2 \\
        T \approx 10^{7} K \\
        M \approx \frac{1}{2} M_{\odot} \\
        l \approx R_{\odot}/20 \\
        H = \frac{L_{\odot}}{4 \pi r^{2}} \\
        \Delta \nabla T \approx 2 \times 10^{-10} \\
        \frac{dT}{dr} \approx \frac{\bar{T}}{R_{\odot}} \approx 6 \times 10^{-5}
    \end{gathered}
\end{equation}

\end{document}

I do agree with comments because \\ are necessary in LaTeX. You will take the habits :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.