7

I'm making 4 vectors of length 8 with the following code:

\documentclass{article}
\usepackage{enumitem}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsthm}
\usepackage{amsfonts} \newcommand\N{\mathbb{N}}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\newcommand{\powerset}{\raisebox{.15\baselineskip}{\Large\ensuremath{\wp}}}
\newcommand\tab[1][1cm]{\hspace*{#1}}
\title{ Groupwork}
\author{some names}
\date{June 2018}
\begin{document}
\maketitle

\section*{Exercise 1}
\begin{enumerate}[label={\alph*)}]
\item
%some text here 
Mathijs's: $\begin{bmatrix}2 \\ 1 \\ 2 \\ 0 \\ 1 \\ 1 \\ 0 \\ 1 
\end{bmatrix}$, Abdul: $\begin{bmatrix}2 \\ -2 \\ 0 \\ 1 \\ 1 \\ 2 \\ -1 \\ 
0 \end{bmatrix}$, Oleksandr: $\begin{bmatrix}0 \\ 1 \\ 0 \\ -1\\ -2 \\ 0 \\ 
2 \\ 2 \end{bmatrix}$, Laurens: $ \begin{bmatrix}-1 \\ 2 \\ 2 \\ 1 \\ 1 \\ 
-2 \\ 0\\ 0 \end{bmatrix}$

\end{enumerate}
\end{document}

The problem is demonstrated in the screenshotenter image description here, namely that the size of Mathijs's vectors is clearly smaller/different than the rest and that's because he doesn't have any negative numbers in his vector. I would still like to have that vector to have the same size as the rest. How can i do that?

7

You may work with \hphantom.

\documentclass{article}
\usepackage{enumitem}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsthm}
\usepackage{amsfonts} \newcommand\N{\mathbb{N}}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\newcommand{\powerset}{\raisebox{.15\baselineskip}{\Large\ensuremath{\wp}}}
\newcommand\tab[1][1cm]{\hspace*{#1}}
\title{ Groupwork}
\author{some names}
\date{June 2018}
\begin{document}
\maketitle

\section*{Exercise 1}
\begin{enumerate}[label={\alph*)}]
\item
%some text here 
Mathijs's: $\begin{bmatrix}\hphantom{-2}\makebox[0pt][r]{2\;\,} \\ 1 \\ 2 \\ 0 \\ 1 \\ 1 \\ 0 \\ 1 
\end{bmatrix}$, Abdul: $\begin{bmatrix}2 \\ -2 \\ 0 \\ 1 \\ 1 \\ 2 \\ -1 \\ 
0 \end{bmatrix}$, Oleksandr: $\begin{bmatrix}0 \\ 1 \\ 0 \\ -1\\ -2 \\ 0 \\ 
2 \\ 2 \end{bmatrix}$, Laurens: $ \begin{bmatrix}-1 \\ 2 \\ 2 \\ 1 \\ 1 \\ 
-2 \\ 0\\ 0 \end{bmatrix}$

\end{enumerate}
\end{document}

enter image description here

But personally I would not do that.

  • Why not and how would you get around this? – Does it matter May 3 '18 at 18:32
  • 4
    @AbdulMalekAltawekji This is really just personal taste. I see why you want to make things uniform, but then there is the point that this "wastes" some space. So it depends on your preferences what you value higher. – user121799 May 3 '18 at 18:35
6

Use \makebox:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{amsmath,amsthm}
\usepackage{amsfonts}
\usepackage{calc}
\usepackage{graphicx}
\usepackage[a4paper, total={6in, 8in}]{geometry}

\newcommand{\powerset}{{\mathpalette\myraise\wp}}
\newcommand{\myraise}[2]{%
  \vcenter{\hbox{\scalebox{1.4}{$#1#2$}}}%
}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\newcommand\N{\mathbb{N}}

\newcommand{\adjwd}[2]{\makebox[\widthof{$#1$}]{#2}}

\title{Groupwork}
\author{some names}
\date{June 2018}

\begin{document}
\maketitle

\section*{Exercise 1}
\begin{enumerate}[label={\alph*)}]
\item
%some text here 
Mathijs's:
  $\begin{bmatrix}\adjwd{-2}{2} \\ 1 \\ 2 \\ 0 \\ 1 \\ 1 \\ 0 \\ 1 \end{bmatrix}$,
Abdul:
  $\begin{bmatrix}2 \\ -2 \\ 0 \\ 1 \\ 1 \\ 2 \\ -1 \\ 0 \end{bmatrix}$,
Oleksandr:
  $\begin{bmatrix}0 \\ 1 \\ 0 \\ -1\\ -2 \\ 0 \\ 2 \\ 2 \end{bmatrix}$,
Laurens: $ \begin{bmatrix}-1 \\ 2 \\ 2 \\ 1 \\ 1 \\ -2 \\ 0\\ 0 \end{bmatrix}$

\item Power set $\powerset(X)$
\end{enumerate}

\end{document}

I also suggest a better way to typeset the power set symbol (although I wouldn't use Weierstrass’ p for the purpose).

enter image description here

4

Another solution, with the small makebox package. In addition, a variant with medium-sized matrices, which look better, in my opinion, for matrices with many rows and not so many columns:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{enumitem}
\usepackage{mathtools, nccmath}
\usepackage{bigstrut, makebox}
\newenvironment{mbmatrix}[1][c]{\medsize\begin{bmatrix*}[#1]\bigstrut[t]}{\end{bmatrix*}\endmedsize}

\title{ Groupwork}
\author{some names}
\date{June 2018}

\begin{document}
\maketitle

\section*{Exercise 1}
\begin{enumerate}[label={\alph*)}]
\item
%some text here
Mathijs's: $\begin{bmatrix}\makebox*{$-2$}{$ 2 $} \\ 1 \\ 2 \\ 0 \\ 1 \\ 1 \\ 0 \\ 1
\end{bmatrix}$, Abdul: $\begin{bmatrix}2 \\ -2 \\ 0 \\ 1 \\ 1 \\ 2 \\ -1 \\
0 \end{bmatrix}$, Oleksandr: $\begin{bmatrix}0 \\ 1 \\ 0 \\ -1\\ -2 \\ 0 \\
2 \\ 2 \end{bmatrix}$, Laurens: $ \begin{bmatrix}-1 \\ 2 \\ 2 \\ 1 \\ 1 \\
-2 \\ 0\\ 0 \end{bmatrix}$\medskip
%
\item
%%some text here
Mathijs's: $\begin{mbmatrix}\makebox*{$-2$}{$ 2 $} \\ 1 \\ 2 \\ 0 \\ 1 \\ 1 \\ 0 \\ 1
\end{mbmatrix}$, Abdul: $\begin{mbmatrix}2 \\ -2 \\ 0 \\ 1 \\ 1 \\ 2 \\ -1 \\
0 \end{mbmatrix}$, Oleksandr: $\begin{mbmatrix}0 \\ 1 \\ 0 \\ -1\\ -2 \\ 0 \\
2 \\ 2 \end{mbmatrix}$, Laurens: $ \begin{mbmatrix}-1 \\ 2 \\ 2 \\ 1 \\ 1 \\
-2 \\ 0\\ 0 \end{mbmatrix}$
\end{enumerate}

\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.