2

I have multiple matrices placed next to each other. I would like to label the rows of the matrix on the right-hand side (a label outside of the matrix). For example, I would like to put those Con \eqref{eq4} outside of the matrix.

\documentclass{article}
\usepackage{amsmath}
\usepackage{pdflscape}

\begin{document}
\setcounter{MaxMatrixCols}{40}
\begin{landscape}
\[
\begin{bmatrix}
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
\end{bmatrix}
%
\begin{bmatrix}
x_{00}\\
x_{01}\\
x_{02}\\
x_{03}\\
\vdots\\
x_{10}\\
x_{11}\\
x_{12}\\
x_{13}\\
\vdots\\
x_{(10)0}\\
x_{(10)1}\\
x_{(10)2}\\
x_{(10)3}\\
\vdots\\
w_0\\
w_1\\
w_2\\
w_3\\
\vdots\\
w_{10}
\end{bmatrix}
%
\begin{bmatrix}
\leq 1 & \text{Con} \eqref{eq4}\\
\leq 1 & \text{Con} \eqref{eq4}\\
\leq 1 \\
\vdots\\
\leq 1\\
\leq 1\\
\leq 1\\
\vdots\\
=1\\
=1\\
=0\\
=0\\
=0\\
=0\\
\vdots\\
\geq g_1-M\\
\geq g_2-M\\
\geq g_3-M\\
\vdots\\
=0\\
\leq C_1\\
\leq C_1\\
\leq C_1\\
\vdots\\
\leq C_1\\
\end{bmatrix}
\]
\end{landscape}
\end{document}

1 Answer 1

2

If you use "long stacks" (that have a fixed baselineskip) as part of the tabstackengine package, then setting multiple column vectors to the right will automatically align vertically. \<prefix>Matrixstack and \<prefix>Vectorstack are instances of long stacks, where <prefix> can be left blank or paren, bracket, vert or brace.

inter-column gaps and inter-row baselineskips can be set.

\documentclass{article}
\usepackage{amsmath}
\usepackage{pdflscape}
\usepackage{tabstackengine}
\begin{document}
\setcounter{MaxMatrixCols}{40}
\begin{landscape}
\setstackgap{L}{1.1\normalbaselineskip}% INTER-ROW BASELINESKI{P
\setstacktabbedgap{8pt}% INTER-COLUMN GAP
\[
\bracketMatrixstack{
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 \\
 &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots &  &  &  &  & \ddots & \\
 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 & 0 & \ldots & 0
}
%
\bracketVectorstack{
x_{00}\\
x_{01}\\
x_{02}\\
x_{03}\\
\vdots\\
x_{10}\\
x_{11}\\
x_{12}\\
x_{13}\\
\vdots\\
x_{(10)0}\\
x_{(10)1}\\
x_{(10)2}\\
x_{(10)3}\\
\vdots\\
w_0\\
w_1\\
w_2\\
w_3\\
\vdots\\
w_{10}
}
%
\bracketVectorstack{
\leq 1 \\
\leq 1 \\
\leq 1 \\
\vdots\\
\leq 1\\
\leq 1\\
\leq 1\\
\vdots\\
=1\\
=1\\
=0\\
=0\\
=0\\
=0\\
\vdots\\
\geq g_1-M\\
\geq g_2-M\\
\geq g_3-M\\
\vdots\\
=0\\
\leq C_1\\
\leq C_1\\
\leq C_1\\
\vdots\\
\leq C_1
}
\Vectorstack{
\text{Con} \eqref{eq4}\\
\text{Con} \eqref{eq4}\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
}
\]
\end{landscape}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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