[Tex/LaTex] Making arrays the same width

arrays

I'm very new to Latex and am trying to write in a solution to total matrix. I have used this:

\end{array}\right)$$=$$\left(\begin{array}{cccc|c}  
1 & 0 & 0 & -\frac{1}{2}t & 0\\  
0 & 0 & 0 & -\frac{1}{4}t & 0\\
0 & 0 & 1 & \frac{1}{4}t & 0\\ 
0 & 0 & 0 & 0 & 0 
\end{array}\right)$\\\\

\end{array}\right)$$=$$\left(\begin{array}{cccc|c}  
1 & 0 & 0 & -\frac{1}{2}t & 0\\  
0 & 0 & 0 & -\frac{1}{4}t & 0\\
0 & 0 & 1 & 28978 & 0\\ 
0 & 0 & 0 & 0 & 0 
\end{array}\right)$\\\\

The problem is that I have a whole bunch of these and some of the are wider than others, which does not look very nice.

Is there any way to declare a certain size for all of the arrays that I have made?

Best Answer

(revised this answer completely after receiving further information from the OP)

I'm not sure if I understand that nature of your array environments. It seems they all have five columns, and that the fourth column can have entries of widely varying widths. Suppose, furthermore, that the single widest entry in any of the arrays' fourth columns is the number "28978". If that's the case, it suffices to exchange the variable-widtyh c column type with a fixed-width column type, as is done in the code shown below.

enter image description here

\documentclass{article}
\newlength\mylen
\settowidth{\mylen}{$28978$} % calculate width of widest element
\usepackage{array} % for "\newcolumntype" macro
\newcolumntype{Q}{>{\centering$}p{\mylen}<{$}}

\begin{document}
\renewcommand\arraystretch{1.33}
\[
\left(\begin{array}{cccQ|c}  
1 & 0 & 0 & -\frac{1}{2}t & 0\\  
0 & 0 & 0 & -\frac{1}{4}t & 0\\
0 & 0 & 1 & \frac{1}{4}t & 0\\ 
0 & 0 & 0 & 0 & 0 
\end{array}\right)
\]

\[
\left(\begin{array}{cccQ|c}  
1 & 0 & 0 & -\frac{1}{2}t & 0\\  
0 & 0 & 0 & -\frac{1}{4}t & 0\\
0 & 0 & 1 & 28978 & 0\\ 
0 & 0 & 0 & 0 & 0 
\end{array}\right)
\]
\end{document}
Related Question