# Need help with tables

This is my code:

\documentclass[a4paper, french, 12pt]{article}
\usepackage{amsfonts}
\usepackage{indentfirst}
\usepackage{xcolor}
\usepackage{array}
\usepackage{booktabs}
\usepackage[margin=0.5in]{geometry}

\title{\textsc{\fbox{Rappel de trigonométrie}}}
\date{}
\begin{document}

\maketitle
\pagenumbering{gobble}
\renewcommand{\thesection}{\Roman{section})}
\section{\color{red}Valeurs remarquables et formules élémentaires}

Voici un tableau des valeurs remarquables concernant les fonctions trigonométriques:

\begin{center}
$\begin{array}{@{} l *{6}{>{\displaystyle}c} @{}} \toprule x & 0 &\frac{\pi}{6} &\frac{\pi}{4} &\frac{\pi}{3} &\frac{\pi}{2}&\pi\\ \midrule \cos(x) & 1 &\frac{\sqrt3}{2}&\frac{\sqrt2}{2}&\frac{1}{2} &0 &-1 \\ \addlinespace \sin(x) & 0 &\frac{1}{2} &\frac{\sqrt2}{2}&\frac{\sqrt3}{2}&1 &0 \\ \addlinespace \tan(x) & 0 &\frac{1}{\sqrt3}&1 &\sqrt3 & / &0 \\ \bottomrule \end{array}$
\end{center}
\par
Les fonctions $\cos$ et $\sin$ sont reliées par la formule suivante:
\begin{center}
\fbox{$\forall x \in \mathbb{R}, \cos(x) + \sin(x) = 1$}
\end{center}

\end{document}


And I'd like to close the table on the right and left sides could u help me plz?

• Marmot already gave you the better looking table in tex.stackexchange.com/questions/498143/… You should avoid vertical lines in tabular material. Commented Jul 1, 2019 at 4:04
• Ok ok no problem then ^^ Why should I avoid vertical lines though I thought it’d look cooler as I’m just rewriting my lessons currently Commented Jul 1, 2019 at 4:06
• mirrors.ctan.org/macros/latex/contrib/booktabs/booktabs.pdf This pdf is also on your computer and you can access it with texdoc booktabs in a terminal. Commented Jul 1, 2019 at 4:14
• Don't use \pagenumbering{gobble}, but rather \pagestyle{empty}. Add also \thispagestyle{empty} after \maketitle. Beware that the final formula is wrong. Commented Jul 1, 2019 at 14:02

I would do something like this:

\documentclass[a4paper, french, 12pt]{article}
\usepackage{amsfonts}
\usepackage{indentfirst}
\usepackage{xcolor}
\usepackage{array}
\usepackage{booktabs}
\usepackage[margin=0.5in]{geometry}
\newcommand{\mystrut}{\rule[-16pt]{0pt}{38pt}}
\title{\textsc{\fbox{Rappel de trigonométrie}}}
\date{}

\begin{document}
\maketitle
\pagenumbering{gobble}
\renewcommand{\thesection}{\Roman{section})}
\section{\color{red}Valeurs remarquables et formules élémentaires}
Voici un tableau des valeurs remarquables concernant les fonctions trigonométriques:
$\begin{array}{|>{ \mystrut}l|*{6}{>{\displaystyle}c}|} \hline x & 0 &\frac{\pi}{6} &\frac{\pi}{4} &\frac{\pi}{3} &\frac{\pi}{2}&\pi\\ \hline \cos(x) & 1 &\frac{\sqrt3}{2}&\frac{\sqrt2}{2}&\frac{1}{2} &0 &-1 \\ \sin(x) & 0 &\frac{1}{2} &\frac{\sqrt2}{2}&\frac{\sqrt3}{2}&1 &0 \\ \tan(x) & 0 &\frac{1}{\sqrt3}&1 &\sqrt3 & / &0 \\ \hline \end{array}$

Les fonctions $\cos$ et $\sin$ sont reliées par la formule suivante:
$\fbox{\forall x \in \mathbb{R}, \cos^{2}(x) + \sin^{2}(x) = 1}$
\end{document}


With the same strut at the beginning of every row (set with >{\mystrut}) all the rows have the same height, but you can also put a different strut at the beginning of a single line for different heights.

No need to use center environment if you use $...$, displaymath is already centered.

The result will be ugly, but if you want to close the table, you can do it like this:

\documentclass[a4paper, french, 12pt]{article}
\usepackage{amsfonts}
\usepackage{indentfirst}
\usepackage{xcolor}
\usepackage{array}
\usepackage{booktabs}
\usepackage[margin=0.5in]{geometry}

\title{\textsc{\fbox{Rappel de trigonométrie}}}
\date{}
\begin{document}

\maketitle
\pagenumbering{gobble}
\renewcommand{\thesection}{\Roman{section})}
\section{\color{red}Valeurs remarquables et formules élémentaires}

Voici un tableau des valeurs remarquables concernant les fonctions trigonométriques:

\begin{center}
\setlength{\abovetopsep}{0pt}
\setlength{\belowbottomsep}{0pt}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
$\begin{array}{|@{} l *{6}{>{\displaystyle}c} @{}|} \toprule x & 0 &\frac{\pi}{6} &\frac{\pi}{4} &\frac{\pi}{3} &\frac{\pi}{2}&\pi\\ \midrule \cos(x) & 1 &\frac{\sqrt3}{2}&\frac{\sqrt2}{2}&\frac{1}{2} &0 &-1 \\ %\addlinespace \sin(x) & 0 &\frac{1}{2} &\frac{\sqrt2}{2}&\frac{\sqrt3}{2}&1 &0 \\ %\addlinespace \tan(x) & 0 &\frac{1}{\sqrt3}&1 &\sqrt3 & / &0 \\ \bottomrule \end{array}$
\end{center}
\par
Les fonctions $\cos$ et $\sin$ sont reliées par la formule suivante:
\begin{center}
\fbox{$\forall x \in \mathbb{R}, \cos(x) + \sin(x) = 1$}
\end{center}

\end{document}


• Why are you removing the horizontal space at the begin and end of the tabular? It makes the result worse than it has to be. Commented Jul 2, 2019 at 4:28

for fun ... with amsmath, amssymb and makecell:

\documentclass[a4paper, french, 12pt]{article}
\usepackage{amsmath, amssymb}
\usepackage{xcolor}
\usepackage{array, booktabs, makecell}
\usepackage[margin=0.5in]{geometry}
\renewcommand{\thesection}{\Roman{section})}

\title{\textsc{\fbox{Rappel de trigonométrie}}}
\date{}

\begin{document}
\thispagestyle{empty}
\maketitle
\section{\color{red}Valeurs remarquables et formules élémentaires}
Voici un tableau des valeurs remarquables concernant les fonctions trigonométriques:
$\setcellgapes{5pt} \makegapedcells \begin{array}{| l |*{6}{c} |} \hline x & 0 & \dfrac{\pi}{6} & \dfrac{\pi}{4} & \dfrac{\pi}{3} & \dfrac{\pi}{2} & \pi \\ \hline \cos(x) & 1 & \dfrac{\sqrt3}{2} & \dfrac{\sqrt2}{2} & \dfrac{1}{2} & 0 & -1 \\ \sin(x) & 0 & \dfrac{1}{2} &\dfrac{\sqrt2}{2} & \dfrac{\sqrt3}{2} & 1 & 0 \\ \tan(x) & 0 & \dfrac{1}{\sqrt3} & 1 & \sqrt3 & \infty & 0 \\ \hline \end{array}$

Les fonctions $\cos$ et $\sin$ sont reliées par la formule suivante:
$\fbox{\forall x \in \mathbb{R},\quad \cos^{2}(x) + \sin^{2}(x) = 1}$
\end{document}