Hello. Greetings from Germany.
I am looking for a way to left-align a labelled equation in R Markdown / Bookdown pdf article. I managed to get a left-aligned equation below, but it voids the label.
$\begin{aligned}
& x_{t} =
\begin{cases}
t, & \textrm{if }t < 100 \\
2 \cdot t, & \textrm{if }t \geq 100
\end{cases},
(\#eq:eq1)
\end{aligned}$
\begin{aligned} & x_{t} = \begin{cases} t, & \textrm{if }t < 100 \\ 2 \cdot t, & \textrm{if }t \geq 100 \end{cases}, (\#eq:eq1) \end{aligned}
Following an answer at StackOverflow, I tried to enclose the aligned environment in the {equation} environment, and in this case, the label works, but the alignment does not as I cannot put an &
at the beginning of the equation nor can I put the whole thing in math modes $ ... $
/ $$ ... $$
, like in the example above:
\begin{equation}
\begin{aligned}
x_{t} =
\begin{cases}
t, & \textrm{if }t < 100 \\
2 \cdot t, & \textrm{if }t \geq 100
\end{cases},
\end{aligned}
(\#eq:eq2)
\end{equation}
The above gets knitr'ed but I don't seem to be able to use the &
ahead of x_{t} =
nor the math blocks. I think I tried the {align} environment, which according to Bookdown documentation should accept labeling, but I wasn't able to get the left-alignment with it.
Does anyone have an idea how to get this to work, i.e. have a left margin-aligned equation and a working label?