Take the 2-minute tour ×
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.

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?

\begin{equation} 
\varphi_{i,j,k}^{n+1} = \varphi_{i,j,k}^{n} + \delta t \frac{1}{|x^3|}
\begin{smallmatrix} 
\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\\
\end{smallmatrix} 
\end{equation}
share|improve this question
3  
When things look that bad, I usually try to rethink my notation! –  Ian Thompson Jun 10 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 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 at 12:00
    
It's the result of an finite volume method of the euler equations –  Thomas Jun 10 at 12:05
2  
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 at 12:08

1 Answer 1

up vote 6 down vote accepted
% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{equation} 
\varphi_{i,j,k}^{n+1} = \varphi_{i,j,k}^{n} + \delta t \frac{1}{|x^3|}\mathbf{A}
\end{equation}
where
\begin{equation} 
\mathbf{A}=\frac{1}{2} \mathbf{B}
\begin{pmatrix} 
\partial x\\\partial y\\\partial z
\end{pmatrix} 
\end{equation}
where 
\begin{equation} 
\mathbf{B}= \begin{pmatrix} 
a & b & c\\
d & e & f\\
g & h & i
\end{pmatrix} 
\end{equation}
where
\begin{align*}
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}\\
&\mathrel{\phantom{=}}\dots
\end{align*}
\end{document}

enter image description here

share|improve this answer
1  
haven't checked the math on that... But you get the idea. –  LaRiFaRi Jun 10 at 12:28
2  
The math is correct. –  Thomas Jun 10 at 12:29
    
Thanks for your great help –  Thomas Jun 10 at 12:29
1  
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 at 12:30
1  
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 at 12:31

Your Answer

 
discard

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.