# [Tex/LaTex] Code to generate ‘fcolorbox’ throws error messages – What is the cause

colorerrors

I'm a new user of TeX. I'm actually writing my first document. I started to type a basic equation and I want to colorize it in a box.
Here is the code:

\documentclass{article}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage{color}

\begin{document}

\begin{center}
{\large \textbf{COMMENT RÉSOUDRE UNE ÉQUATION ?}}
\end{center}

\fcolorbox{brun}{chamois}{\parbox{\linewidth}
{\begin{center}
Résoudre l'équation (E):
$(x^{2} + 1)^{2} = (x^ {2} - 1)^{2}$\ d'inconnue x $\in \mathbb{R} }$\end{center}
\end{document}}

When I press F1, I got many errors regarding line 20? What's wrong?

Regards

I'm not sure if there's a package which uses French colour names out of the box, so I've substituted red and yellow. Please note that color is very limited in the number of predefined colours it has, although you can define new ones as you like, and you can give them French names, or any name you want really.

But for the purposes of fixing this error, try this:

\documentclass{article}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage{color}

\begin{document}

\begin{center}
{\large \textbf{COMMENT RÉSOUDRE UNE ÉQUATION ?}}
\end{center}

\fcolorbox{red}{yellow}{\parbox{\linewidth}{
\begin{center}
Résoudre l'équation (E):
$(x^{2} + 1)^{2} = (x^{2} - 1)^{2}$
d'inconnue $x \in \mathbb{R}$
\end{center}
}
}

\end{document}

I've moved your x inside $...$ for $x \in \mathbb{R}$ and tidied up some of your code formatting to make it easier to see where you went wrong.

Your main mistake was you needed \parbox{\linewidth}{foo} with braces around foo. You had mistakenly put your closing brace after \mathbb{R}, within $...$ and within the center environment.

You also had a } after \end{document}.

This should work, although I'll leave you to select the colours you want to use, as I have no idea what chamois is supposed to look like!

Also, consider using display math: $...$:

\documentclass{article}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{color}

\begin{document}

\begin{center}
{\large \textbf{COMMENT RÉSOUDRE UNE ÉQUATION ?}}
\end{center}

\fcolorbox{red}{yellow}{\parbox{0.9\linewidth}{
$\text{Résoudre l'équation (E): } (x^{2} + 1)^{2} = (x^{2} - 1)^{2} \text{ d'inconnue } x \in \mathbb{R}$
}
}

\end{document}