markup icon indicating copy to clipboard operation
markup copied to clipboard

Can't align math equations to the left of page

Open user72356 opened this issue 3 years ago • 1 comments

I'm unable to align mathematical equations to the left of the page in markdown:

$$
sin⁡(α)={opposite \over hypotenuse}={h0 \over c}={h2 \over b}
$$

$$ sin⁡(α)={opposite \over hypotenuse}={h0 \over c}={h2 \over b} $$

I know I can use flalign to align the entire block:

$$
\begin{flalign}
& sin⁡(α)={opposite \over hypotenuse}={h0 \over c}={h2 \over b} &
\end{flalign}
$$

$$ \begin{flalign} & sin⁡(α)={opposite \over hypotenuse}={h0 \over c}={h2 \over b} & \end{flalign} $$

But it prevents me from using the other Latex alignment environments concurrently, such as align and alignat, that can be used to align equal signs in a multiline equation:

$$
\begin{alignat*}{4}
& sin⁡(α) &&= {opposite \over hypotenuse} &&= {h0 \over c} &&= {h2 \over b} \\
& cos(α) &&= {adjacent \over hypotenuse} &&= {b \over c}  &&= {d \over b} \\
& tan⁡(α) &&= {opposite \over adjacent}   &&= {h0 \over b} &&= {h2 \over d}
\end{alignat*}
$$

$$ \begin{alignat*}{4} & sin⁡(α) &&= {opposite \over hypotenuse} &&= {h0 \over c} &&= {h2 \over b} \ & cos(α) &&= {adjacent \over hypotenuse} &&= {b \over c} &&= {d \over b} \ & tan⁡(α) &&= {opposite \over adjacent} &&= {h0 \over b} &&= {h2 \over d} \end{alignat*} $$

Displaying the equation inline works, but it decreases the font size too much, which is even more of an issue for complex equations.

user72356 avatar Jul 07 '22 16:07 user72356

I was also interested in this question, so I studied the description of different types of "environments" in these documents:

  • https://en.wikibooks.org/wiki/LaTeX/Mathematics
  • https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics
  • https://www.latex-project.org/help/documentation/amsldoc.pdf
  • https://katex.org/docs/supported.html
  • https://ctan.math.illinois.edu/obsolete/info/math/voss/mathmode/Mathmode.pdf

and experimented with what is written there using GitHub. I see no reason to waste time on a detailed description, in short, part of the described "environments" gives the error "KaTeX parse error: No such environment", part aligns math equations in the middle. As a result, I found the only option that aligns on the left:

    $
    \begin{aligned}
    &sin⁡(α) = {opposite \over hypotenuse} = {h0 \over c} = {h2 \over b} \\
    &cos(α) = {adjacent \over hypotenuse} = {b \over c} = {d \over b} \\
    &tan⁡(α) = {opposite \over adjacent} = {h0 \over b} = {h2 \over d}
    \end{aligned}
    $

yazon315 avatar Mar 29 '23 23:03 yazon315