Nice output for examination

fontsmdframedpdftexrulestcolorbox

We currently have this MWE with classic Palatino font (or with Times NR).

\documentclass[a4paper,12pt]{article}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage{mathtools,amssymb,tikz}
\usepackage[top=2.5cm,bottom=2.2cm,left=1.5cm,right=1.5cm,headsep=10pt,a4paper]{geometry}
\usepackage{graphicx,xcolor}
\usepackage{newpxtext,newpxmath}
\makeatother
\newcommand*{\starthfill}{\noindent\makebox[0pt]{}\hfill}
\newcommand*{\hfillend}{\hfill\makebox[0pt]{}}
\newcommand*{\riga}{\noindent\starthfill\rule{8cm}{0.7pt}\hfillend\par}
\thispagestyle{empty}
\begin{document}

\begin{center}
\textsc{\textbf{{\large Liceo \\ (sez. ass.)}\\
Prova scritta di Fisica\\
Sezione A}}
\end{center}
\riga
\vskip .3cm
\parindent 0cm
\textit{Durante la prova non è consentito consultare libri, appunti e strumentazione elettronica ad eccezione di una calcolatrice scientifica o standard ma non l'app dello smartphone.}

\vskip .5cm
Lo studentessa risolva a scelta \textbf{solo tre} dei seguenti quattro problemi/quesiti/esercizi.


\vskip 1.5cm
\begin{center}
\textbf{I}
\end{center}
Una carica puntiforme $q =-0.35$ nC è fissata all'origine. Dove deve
un protone affinché la forza elettrica che agisce su di esso sia
esattamente opposta al suo peso? (Che l'asse $y$ sia verticale e l'asse $x$
sia orizzontale).

\vskip 1cm
\begin{center}
\textbf{II}
\end{center}
Supponi che la carica $q_2$ della figura sottostante possa essere spostata a sinistra o a destra lungo la linea che congiunge $q_1$ e $q_3$. Data $q = +12 \mu$C, calcola a quale distanza da $q_1$ la forza a cui è sottoposta $q_2$ si annulla.
\vskip .5cm
\begin{center}

\end{center}

\vskip .5cm
\begin{center}
\textbf{III}
\end{center}

Due cariche puntiformi di eguale valore distano tra di loro 7.5 cm. Nel punto medio della congiungente le due cariche il campo elettrostatico risultante è 45 N/C. Calcola il valore delle cariche e il loro segno.


\end{document}

The screenshot is:

enter image description here

  1. I would like to put a background in the head below the title like in this image below

enter image description here

  1. and to realize, for each problem, this style

enter image description here

where the Example (Problema) should have a font that is a clone of Optima font or Gillius in pdfLaTeX.

Best Answer

I hope I understood everything correctly since you seem to ask multiple things at once, but you could maybe start with this approach:

(Thanks to @dexteritas for his suggestion for improvement!)

\documentclass[a4paper,12pt]{article}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[top=2.5cm,bottom=2.2cm,left=1.5cm,right=1.5cm,headsep=10pt,a4paper]{geometry}
\usepackage{mathtools,amssymb,tikz}
\usepackage{graphicx,xcolor}
\usepackage{newpxtext,newpxmath}

\usepackage{gillius}
\usepackage[letterspace=100]{microtype}

\newcommand*{\starthfill}{\noindent\makebox[0pt]{}\hfill}
\newcommand*{\hfillend}{\hfill\makebox[0pt]{}}
\newcommand*{\riga}{\noindent\starthfill\rule{8cm}{0.7pt}\hfillend\par}

\usetikzlibrary{tikzmark}

\usepackage{tcolorbox}
\tcbuselibrary{skins}

\newcounter{problema}
\newtcolorbox{problema}[2][]{
    empty,
    boxsep=0pt, left=0pt, right=10pt,
    boxrule=0pt,
    coltitle=black,
    title={%
        \sffamily\large%
        \textbf{\color{cyan}\lsstyle\MakeUppercase{Problema}\ifstrempty{#1}{}{~#1}:}%
        \tikzmark{titlemark \theproblema}\quad#2%
    },
    before title={\stepcounter{problema}},
    after upper={\tikzmark{endmark \theproblema}},
    remember,
    overlay={
        \begin{scope}[remember picture, overlay, cyan, line width=1pt]
            \draw ([yshift=5pt]frame.north west) -- 
                ([yshift=5pt]frame.north east) |-
                ([xshift=5pt]pic cs:endmark \theproblema);
            \draw[fill=cyan] ([xshift=5pt]pic cs:endmark \theproblema) rectangle
                ++(5pt,5pt);
            \draw[fill=cyan] ([yshift=5pt]frame.north west) rectangle
                ++({pic cs:titlemark \theproblema} |- 3pt,3pt);
        \end{scope}
    },
}

\newtcolorbox{introduzione}{
    tile,
    colbacklower=lightgray,
}

\thispagestyle{empty}
\begin{document}

\begin{center}
\textsc{\textbf{{\large Liceo \\ (sez. ass.)} \\
Prova scritta di Fisica \\
Sezione A}}
\end{center}

\riga

\begin{introduzione}
\textit{Durante la prova non è consentito consultare libri, appunti e strumentazione elettronica ad eccezione di una calcolatrice scientifica o standard ma non l'app dello smartphone.}

\vskip .5cm
Lo studentessa risolva a scelta \textbf{solo tre} dei seguenti quattro problemi/quesiti/esercizi.
\end{introduzione}

\vskip 1cm
\begin{problema}[I]{Il primo problema}
Una carica puntiforme $q =-0.35$ nC è fissata all'origine. Dove deve
un protone affinché la forza elettrica che agisce su di esso sia
esattamente opposta al suo peso? (Che l'asse $y$ sia verticale e l'asse $x$
sia orizzontale).
\end{problema}

\vskip 1cm
\begin{problema}[II]{Il secondo problema}
Supponi che la carica $q_2$ della figura sottostante possa essere spostata a sinistra o a destra lungo la linea che congiunge $q_1$ e $q_3$. Data $q = +12 \mu$C, calcola a quale distanza da $q_1$ la forza a cui è sottoposta $q_2$ si annulla.
\end{problema}

\vskip 1cm
\begin{problema}[III]{Il terzo problema}
Due cariche puntiformi di eguale valore distano tra di loro 7.5 cm. Nel punto medio della congiungente le due cariche il campo elettrostatico risultante è 45 N/C. Calcola il valore delle cariche e il loro segno.
\end{problema}

\end{document}

enter image description here

Related Question