TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a problem formatting this equation. It's containing a 5x1 matrix and the content of a cell in a matrix is pretty long. All in all it does not fit on the page. Should I use split() or is there another option?

\varphi_{i,j,k}^{n+1} = \varphi_{i,j,k}^{n} + \delta t \frac{1}{|x^3|}
\frac{1}{2}((\rho v_1)_{i,j+1,k}-(\rho v1)_{i,j-1,k})\delta x + \frac{1}{2}((\rho v_2)_{i+1,j,k}-(\rho v_2)_{i-1,j,k})\delta y + \frac{1}{2}((\rho v_3)_{i,j,k+1}-(\rho v_3)_{i,j,k-1})\delta z\\
\frac{1}{2}((\rho v_1^2+p)_{i,j+1,k}-(\rho v_1^2+p)_{i,j-1,k})\delta x + \frac{1}{2}((\rho v_1 v_2)_{i+1,j,k}-(\rho v_1 v_2)_{i-1,j,k})\delta y + \frac{1}{2}((\rho v_1 v_3)_{i,j,k+1}-(\rho v_1 v_3)_{i,j,k-1})\delta z\\
\frac{1}{2}((\rho v_2 v_1)_{i,j+1,k}-(\rho v_2 v_1)_{i,j-1,k})\delta x + \frac{1}{2}((\rho v_2^2+p)_{i+1,j,k}-(\rho v_2^2+p)_{i-1,j,k})\delta y + \frac{1}{2}((\rho v_2 v_3)_{i,j,k+1}-(\rho v_2 v_3)_{i,j,k-1})\delta z\\
\frac{1}{2}((\rho v_3 v_1)_{i,j+1,k}-(\rho v_3 v_1)_{i,j-1,k})\delta x + \frac{1}{2}((\rho v_3 v_2)_{i+1,j,k}-(\rho v_3 v_2)_{i-1,j,k})\delta y + \frac{1}{2}((\rho v_3^2+p)_{i,j,k+1}-(\rho v_3^2+p)_{i,j,k-1})\delta z\\
\frac{1}{2}(((\rho E+p)v_1)_{i,j+1,k}-((\rho E+p)v_1)_{i,j-1,k})\delta x + \frac{1}{2}(((\rho E+p)v_2)_{i+1,j,k}-((\rho E+p)v_2)_{i-1,j,k})\delta y + \frac{1}{2}(((\rho E+p)v_3)_{i,j,k+1}-((\rho E+p)v_3)_{i,j,k-1})\delta z\\
share|improve this question
When things look that bad, I usually try to rethink my notation! – Ian Thompson Jun 10 '14 at 11:53
Yeah well, I agree you, but to rethink the notation of a equation is pretty hard. Since you cannot change an equation that much – Thomas Jun 10 '14 at 12:00
I agree with Ian. This is hardly readable as it is. What does the expression inside the smallmatrix even mean. – daleif Jun 10 '14 at 12:00
It's the result of an finite volume method of the euler equations – Thomas Jun 10 '14 at 12:05
factorize as much as you can. Get \frac{1}{2} out of there, do a scalar product with the vector (dx, dy, dz) (just examples) and then start introducing variables for each matrix cell. \begin{smallmatrix}A\\BC\\D\\E\end{smallmatrix} where A=((\rho v_1)_{i,j+1,k}-(\rho v1)_{i,j-1,k})... – LaRiFaRi Jun 10 '14 at 12:08
up vote 6 down vote accepted
% arara: pdflatex


\varphi_{i,j,k}^{n+1} = \varphi_{i,j,k}^{n} + \delta t \frac{1}{|x^3|}\mathbf{A}
\mathbf{A}=\frac{1}{2} \mathbf{B}
\partial x\\\partial y\\\partial z
\mathbf{B}= \begin{pmatrix} 
a & b & c\\
d & e & f\\
g & h & i
a &= (\rho v_1)_{i,j+1,k}-(\rho v_1)_{i,j-1,k}\\
b &= (\rho v_2)_{i+1,j,k}-(\rho v_2)_{i-1,j,k}\\

enter image description here

share|improve this answer
haven't checked the math on that... But you get the idea. – LaRiFaRi Jun 10 '14 at 12:28
The math is correct. – Thomas Jun 10 '14 at 12:29
Thanks for your great help – Thomas Jun 10 '14 at 12:29
You're welcome. Note that I put one underline to the first v_1. A typo you should get rid of before book release. Happy TeXing! – LaRiFaRi Jun 10 '14 at 12:30
Nice refactoring. I'd consider inserting B from (3) into (2), or even folding (2) and (3) into (1), keeping just the definitions of a, b, ... separate. OP's choice. – Ethan Bolker Jun 10 '14 at 12:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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