I would to build, for my students, a creative collection of exercises and problems. I am not very able, with my source in attachment, to create the same figure shown in attachment. Someone, please, could you help me?
\documentclass[italian]{book}
\usepackage{amssymb,latexsym, mathtools}
\usepackage[utf8]{inputenc}
\usepackage{babel}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{stackengine,xcolor}
\let\svitem\item
\newcommand\difbox[1]{\stackengine{0pt}{\color{gray!30}\rule{5ex}{1.15ex}}{%
\color{red}$\mkern1mu\makeballs{#1}$}{O}{c}{F}{F}{L}}
\def\makeballs#1{\ifnum#1>0\relax{\bullet}%
\expandafter\makeballs\the\numexpr#1-1\relax\fi}
\newenvironment{benumerate}
{\renewcommand\item[1][1]{\def\difficulty{##1}\svitem}%
\def\labelenumi{\smash{\stackunder[1pt]{\color{teal}%
\bfseries\sffamily\large\theenumi}{\difbox{\difficulty}}}}%
\enumerate}{\endenumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{siunitx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titlesec}
\usepackage{multicol}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=2.5cm, right=2.5cm, top=3cm, bottom=2cm]{geometry}
% \usepackage[a4paper,left=2.5cm,right=2.5cm,top=1.5cm,bottom=1.5cm,
% marginparsep=3mm,marginparwidth=18mm,
%headheight=0mm,headsep=0cm,
%footskip=1.5cm,includeheadfoot%,showframe
%]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\usepackage{tikz}
\usetikzlibrary{fadings}
% Headers
\definecolor{gray}{cmyk}{0,0,0,0.4}
\definecolor{darkgrey}{cmyk}{0,0,0,0.6}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhead{} % Remove head fields
\fancyfoot{} % Remove foot fields
\setlength{\headheight}{24pt}
\fancyhead[RO]{\sffamily\bfseries\footnotesize\textcolor{gray}\leftmark\hspace{0.3cm}\sffamily\bfseries\normalsize\textcolor{darkgray}\thepage}
\fancyhead[LE]{\sffamily\bfseries\textcolor{darkgray}\thepage\hspace{0.3cm}\sffamily\bfseries\footnotesize\textcolor{gray}\leftmark}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrule}{%
\vskip-\baselineskip\vskip4pt
\ifodd\count0\hfill\begin{tikzpicture}
\fill[darkgray,path fading=west] (0,0) rectangle (4.98,0.02);
\end{tikzpicture}\else\begin{tikzpicture}
\fill[darkgray,path fading=east] (0,0) rectangle (4.98,0.02);
\end{tikzpicture}\fi}
\parindent0pt
\parskip6pt
\makeatletter
\makeatother
\newcounter{myExercise}[section]
\setcounter{myExercise}{1}
\newcommand\exercise{\textbf{Esercizi \thesection.\stepcounter{myExercise}\themyExercise.\,}}
\newcommand\mySol[1]{\textcolor{cyan!20!blue}{[$#1$]}}
\setlength{\columnsep}{12pt}
\setlength\columnseprule{0pt}
\begin{document}
\section*{Velocità}
\begin{multicols}{2}
\begin{benumerate}
\item[1]
Un'automobile transita al km 25 di un'autostrada alle ore 8:25 e transita al km 29 alle ore 8:27. Qual è la sua velocità media in km/h? \hfill\mySol{120\,\, \text{km/h}}
\item[2] In autostrada ogni kilometro è contrassegnato da un numero. Guardando fuori dal finestrino, ti accorgi che passano 36 s tra un cartello e l'altro. A quale velocità stai procedendo? \hfill\mySol{100\,\, \text{km/h}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\item
\hfill\mySol{\ldots}
\end{benumerate}
\end{multicols}
\end{document}


\geometryremoving\setlength{\topmargin}{-.5in}etc. – Sebastiano Dec 29 '16 at 21:00siunitx, it will give you much more consistency; since you are using theutf8input encoding, if you have an Italian keyboard, you can write directly the accented letters àèéìòù, without the need of using the escape sequences\'e, etc.; for setting margins, you can use thegeometrypackage. – Massimo Ortolano Dec 29 '16 at 21:17utf8input encoding precisely to avoid the several sequences\'e,\'aetc. I used MAC few days ago. You can verify that I mentioned in the previous comment the package\geometry. Could you offer me using my source your idea? – Sebastiano Dec 29 '16 at 21:33TikZor other roads. Like putting a background, a color fringe side, etc. simply usingLaTeX. – Sebastiano Dec 29 '16 at 21:45\setlength{\topskip}{0in}? (It will lead to uneven settings with the position of the first line of each page varying depending on the content of the line.) – David Carlisle Dec 29 '16 at 21:49xcolor,titlesecetc. – samcarter_is_at_topanswers.xyz Dec 29 '16 at 22:52timesis deprecated for a start. You are worrying far too much about all the twiddly bits, in my opinion, and not taking the time you need to learn the basics. – cfr Dec 30 '16 at 02:24geometry. If you say\setlength{\headheight}{24pt},geometrydoesn't know about this and things are bound to go wrong. For the new picture, look attcolorboxand just work on that element. It would not be my priority if my page layout wasn't consistent yet, which is far more basic, but if you are determined to focus on bling, at least try to deal with one variety of bling at a time.tcolorboxwill take some time and work on your part: it is a powerful package. – cfr Dec 31 '16 at 03:38