1

I'm using ipython notebook with the following Tex code

%%latex

We begin with the formulation of Maxwell's Laws. \newline
Once
\begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{aligned}

The %%latex just creates a Tex environment. If I run the code, I get:

We begin with the formulation of Maxwell's Laws. \newline Once
∇×B⃗ −1c∂E⃗ ∂t∇⋅E⃗ ∇×E⃗ +1c∂B⃗ ∂t∇⋅B⃗ =4πcj⃗ =4πρ=0⃗ =0

And the output is correct in that it's in columns, not rows. The problem is I don't know why the \newline is not creating another line.

If try something like:

%%latex
\begin{document}
We begin with the formulation of Maxwell's Laws. \newline
Once
\begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{aligned}
\end{document}

it still doesn't work.

Am I missing some begin-end statements? Do I have to initialize anything?

closed as off-topic by Torbjørn T., user13907, Mensch, Masroor, Svend Tveskæg Aug 31 '14 at 11:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Torbjørn T., Community, Mensch, Masroor, Svend Tveskæg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to TeX.SX! Does the same problem happen if you try to compile the same code outside iPython? – darthbith Aug 7 '14 at 18:26
  • 2
    aligned needs to be within a math-environment, e.g. \begin{equation}\begin{aligned}...\end{aligned}\end{equation} – Torbjørn T. Aug 7 '14 at 19:05
  • 1
    On second thought, this is actually off-topic here, as the question doesn't really have anything to with LaTeX. The %%latex magic is a bit of a misnomer as I understand it, it only activates MathJax, which isn't (La)TeX. \newline doesn't work because LaTeX has nothing to with the rendering of the Notebook itself (unless you export it of course), and it is not inside any math, so MathJax doesn't do anything either. The HTML tag </br> works. Generally, questions about the Notebook should be asked at Stack Overflow. – Torbjørn T. Aug 8 '14 at 18:32
  • The only thing that could be on topic here is how to write a specific math expression, or perhaps how to deal with a .tex file generated by nbconvert. The former is also borderline on-topic at best, as MathJax isn't LaTeX, it only shares some of the syntax. – Torbjørn T. Aug 8 '14 at 18:34

Browse other questions tagged or ask your own question.