4

I am writing a paper that deals with Gaussian integers and I have a section where I am talking about the norm of the units in the Gaussian integers. Since there are only four units in the Gaussian integers, I'd like to have the calculations of their norms appear neatly in four columns that are centered. Basically so that you can easily look down each of the four columns and see the calculations for each unit. What I have right now sort of does that but its very sloppy and I'm sure there is a much cleaner way to do it. I'm still new to Latex so I realize this code is probably painfully inefficient but I would appreciate any suggestions of how to fix it and what packages I'd need to use to implement those changes.

\begin{center}  
$N(1)=N(1+0i)$  
\hspace{.025cm}  
$N(-1)=N(-1+0i)$  
\hspace{.025cm}  
$N(i)=N(0+1i)$  
\hspace{.025cm}  
$N(-i)=N(0-1i)$  
\end{center}  

\begin{center}  
$N(1)=1^2+0$  
\hspace{.1cm}  
$N(-1)=(-1)^2+0^2$  
\hspace{.1cm}  
$N(i)=0^2+1^2$  
\hspace{.1cm}  
$N(-i)=0^2+(-1)^2$  
\end{center}  

\begin{center}  
$N(1)=1$  
\hspace{.5cm}  
$N(-1)=1$  
\hspace{.5cm}  
$N(i)=1$  
\hspace{.5cm}  
$N(-i)=1$  
\end{center}
2
  • Maybe use an array environment?
    – leandriis
    Apr 29, 2019 at 20:12
  • The only problem is that I don't know anything about arrays in Latex. I can look them up and see what I can find but are there any other suggestions that come to mind? Apr 29, 2019 at 20:21

3 Answers 3

4

Here are three different suggestions using either array or alignedat:

enter image description here

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}

\begin{document}

\[ 
\begin{array}{llll}
N(1)=N(1+0i) & N(-1)=N(-1+0i)   & N(i)=N(0+1i) & N(-i)=N(0-1i)   \\
N(1)=1^2+0   & N(-1)=(-1)^2+0^2 & N(i)=0^2+1^2 & N(-i)=0^2+(-1)^2 \\
N(1)=1       & N(-1)=1          & N(i)=1       & N(-i)=1
\end{array}
\]

\[ 
\begin{array}{cccc}
N(1)=N(1+0i) & N(-1)=N(-1+0i)   & N(i)=N(0+1i) & N(-i)=N(0-1i)   \\
N(1)=1^2+0   & N(-1)=(-1)^2+0^2 & N(i)=0^2+1^2 & N(-i)=0^2+(-1)^2 \\
N(1)=1       & N(-1)=1          & N(i)=1       & N(-i)=1
\end{array}
\]


\begin{alignat*}{4}
N(1)&=N(1+0i) &\quad N(-1)&=N(-1+0i)   &\quad    N(i)&=N(0+1i)  &\quad N(-i)&=N(0-1i)   \\
N(1)&=1^2+0   &      N(-1)&=(-1)^2+0^2 &         N(i)&=0^2+1^2  &      N(-i)&=0^2+(-1)^2 \\
N(1)&=1       &      N(-1)&=1          &         N(i)&=1        &      N(-i)&=1
\end{alignat*}

\end{document}
2
  • Thank you very much! This does exactly what I was looking to do. Apr 29, 2019 at 20:29
  • 1
    @AlexAdinolfi: Glad I helped you. If you like my answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and/or marking it as the accepted answer (by clicking on the checkmark ✓). This also applies to all your other questions to which you already recieved answers.
    – leandriis
    Apr 29, 2019 at 20:35
3

I propose this layout:

\documentclass{article}
\usepackage[utf8]{inputenc}%
\usepackage{geometry} 
\usepackage[table, svgnames]{xcolor}
\usepackage{mathtools}
\colorlet{shadecolor}{Gainsboro!50! Lavender}
\newcommand*\shadebox[1]{%
\colorbox{shadecolor}{\hspace{1em}$\displaystyle #1 $\hspace{1em}}}
\begin{document}


\begin{equation}
\begin{gathered}
\begin{aligned}
 N(1) & =N(1+0i)\\
  & =1^2+0^2
\end{aligned} \\[1.5ex]
\shadebox{N(1) = 1}
\end{gathered}
  \qquad
\begin{gathered}
\begin{aligned}
 N(-1) & =N(-1+0i) \\
& =(-1)^2+0^2
\end{aligned} \\[1ex]
 \shadebox{N(-1) = 1}
\end{gathered}
 \qquad
\begin{gathered}
\begin{aligned}
 N(i) & =N(0+1i) \\
  & =0^2+1^2
\end{aligned} \\[1ex]
\shadebox{ N(i) = 1}
\end{gathered}
 \qquad
\begin{gathered}
\begin{aligned}
 N(-i) & =N(0-1i) \\
  & =0^2+(-1)^2
\end{aligned} \\[1ex]
 \shadebox{N(-i) = 1}
\end{gathered}
\end{equation}

\end{document} 

enter image description here

2
  • 1
    Very nice. The parfum of the lavander is fantastic and also the color :-)
    – Sebastiano
    Apr 29, 2019 at 21:18
  • 1
    I like it because I feel it adds some freshness to the Gainsboro grey (b.t.w., is there a Leonardo grey? ;o)
    – Bernard
    Apr 29, 2019 at 21:25
2

For example I would have used the tables in sequence (but it's just a personal taste) to give a touch of vitality. In this case I have used the booktabs package to have \toprule and \bottomrule.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{array}
\usepackage{booktabs}

\begin{document}
\[
\setlength\arraycolsep{0pt}
\renewcommand\arraystretch{1.25}
\begin{array}{r @{{}={}} l}
\toprule
N(1) &N(1+0i)   \\
N(-1)&N(-1+0i)  \\
N(i) &N(0+1i)   \\
N(-i)&N(1+0i)   \\  
\bottomrule
\end{array}
\quad\Rightarrow\quad
\begin{array}{r @{{}={}} l}
\toprule
N(1) &1^2+0     \\
N(-1)&(-1)^2+0^2\\
N(i) &0^2+1^2   \\
N(-i)&0^2+(-1)^2\\  
\bottomrule
\end{array}
\quad\Rightarrow\quad
\begin{array}{r @{{}={}} l}
\toprule
N(1) &1 \\
N(-1)&1 \\
N(i) &1 \\
N(-i)&1 \\  
\bottomrule
\end{array}
\]
\end{document}
0

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.