datelatexalignmenthorizontal-alignment

Issues with horizontal alignment of date when using minipage


I'm trying to create a test for my students. I put the teacher's name, date, start time and duration time on the same line using the minipage environment. I don't know why the date field is not aligned with the other fields. If I write anything other than the date, the text lines up perfectly.

The code I am using in overleaf is:

\documentclass[paper=a4, fontsize=10pt]{scrartcl} 

\usepackage[T1]{fontenc} 
\usepackage{times} 
\usepackage[brazil]{babel} 
\usepackage{amsmath,amsfonts,amsthm}
\usepackage[utf8]{inputenc}      
\usepackage{ae}                        
\usepackage{times}

\usepackage[american voltages, american currents]{circuitikz}
\ctikzset{bipoles/length=2.5em}
\usepackage{anysize}
\marginsize{2cm}{2cm}{1cm}{1cm}
\usepackage{caption}
%\usepackage{columns}

\begin{document}

\begin{minipage}{0.3\textwidth}
 Teacher: Guilherme 
\end{minipage}
  \begin{minipage}{0.2\textwidth}
  Date: 22/06/2022
\end{minipage}
  \begin{minipage}{0.15\textwidth}
  Start: 19:00
\end{minipage}
\begin{minipage}{0.2\textwidth}
  Duration: 120 min
\end{minipage}

\vspace{1.5cm}

\begin{minipage}{0.5\textwidth}
  Student:\underline{\hspace{7cm}}
\end{minipage}
    
\end{document} 

The result is:

Result

How could I solve the problem?


Solution

  • You can bottom-align the minipages:

    \begin{minipage}[b]{0.3\textwidth}
     Teacher: Guilherme 
    \end{minipage}
      \begin{minipage}[b]{0.2\textwidth}
      Date: 22/06/2022
    \end{minipage}
      \begin{minipage}[b]{0.15\textwidth}
      Start: 19:00
    \end{minipage}
    \begin{minipage}[b]{0.2\textwidth}
      Duration: 120 min
    \end{minipage}
    

    Result: Compiled result showing desired effect