5

I am trying to use minipage to get a table next to some text like in the image below. I read on the topic but can't seem to get it together. Any help is appreciated. I am very new to this so if someone could tell me what I am doing wrong that would be great.

I'm getting the following errors:

line 22: Not in outer par mode. \begin{table}[h]
line 22: Undefined control sequence \begin{table}[h]
line 22: Missing number, treated as zero \begin{table}[h]
line 3: Overfull \hbox (2.60513pt too wide) in paragraph
line 23: Overfull \hbox (117.52068pt too wide) in paragraph
line 21: Overfull \hbox (20.2359pt too wide) in paragraph

I know that the \hbox can be fixed by appending % to the end of some lines (maybe?) but I am not quite sure on which lines that is appropriate.

Here is the code from the two files i'm making.

test_title.tex

\documentclass[pdftex,12pt,letterpaper]{report}

\usepackage[pdftex]{graphicx}

\newcommand{\labno}{3}
\newcommand{\labtitle}{Fuerzas Hidrostaticas}
\newcommand{\authorname}{Author 1 \\ Author 2 \\ Author 3 \\ Author 4}
\newcommand{\instructor}{Instructor}
\newcommand{\classno}{Laboratorio INGE4010}

\begin{document}
\input{./title.tex}
\end{document}

title.tex

\begin{titlepage}

\noindent
\includegraphics[width=0.15\textwidth]{UPRMlogo}%
\begin{minipage}[b]{0.7\textwidth}
\centering
Universidad de Puerto Rico \\
Recinto de Mayaguez\\
Departamento de Ingenieria Mecanica
\end{minipage} %
\includegraphics[width=0.15\textwidth]{UPRMlogo}

\vspace*{\stretch{7}}
\begin{center}
\textsc{Laboratorio \#\labno \ \labtitle}
\end{center}
\vspace{\stretch{6}}

\vfill

\begin{minipage}{.2\textwidth} %
\begin{table}[h]
\begin{tabular}{|l|r|}
\hline
\textbf{Partes del Informe} & \multicolumn{1}{c|}{\textbf{Calificación}} \\ \hline
Introducción                & /10                                        \\ \hline
Datos y Cálculos            & /20                                        \\ \hline
Análisis de Resultados      & /45                                        \\ \hline
Conclusiones                & /20                                        \\ \hline
Referencia y Apéndice       & /5                                         \\ \hline
Total                       & /100                                       \\ \hline
\end{tabular}
\end{table}
\end{minipage} %
\begin{minipage}{\textwidth} %
\begin{flushright}
\textsc{\authorname \\ \classno \\ \instructor \\ \today}
\end{flushright}
\end{minipage} %
\end{titlepage}

Example

4
  • 1
    There may be other problems, but: You can't put a floating environment (table) inside a minipage environment. Feb 15, 2015 at 23:09
  • 1
    In other words: comment out the lines: \begin{table}[h] and \end{table}. Also probably want to add a \noindent before your first \begin{minipage} and give the second one something less than a full \textwidth -- maybe 0.8\textwidth instead....
    – jon
    Feb 15, 2015 at 23:17
  • A tabular environment need not be in a table environment.
    – egreg
    Feb 15, 2015 at 23:58
  • So I deleted like jon suggested and that worked. I implemented the solution of egreg since it also took care of my issue with accents in spanish words and changed the language of \today. Feb 16, 2015 at 1:30

2 Answers 2

5

There's no need for a tabular environment to be inside a table.

Here's a simplified version of your title page:

\documentclass[12pt,letterpaper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage[demo]{graphicx}

\newcommand{\labno}{3}
\newcommand{\labtitle}{Fuerzas Hidrostaticas}
\newcommand{\authorname}{Author 1 \\ Author 2 \\ Author 3 \\ Author 4}
\newcommand{\instructor}{Instructor}
\newcommand{\classno}{Laboratorio INGE4010}

\begin{document}

\begin{titlepage}
\centering

\includegraphics[width=0.15\textwidth]{UPRMlogo}%
\begin{minipage}[b]{0.7\textwidth}
\centering
Universidad de Puerto Rico \\
Recinto de Mayaguez\\
Departamento de Ingenieria Mecanica
\end{minipage}%
\includegraphics[width=0.15\textwidth]{UPRMlogo}

\vspace*{\stretch{7}}

\textsc{Laboratorio \#\labno \ \labtitle}

\vspace{\stretch{6}}

\vfill

\begin{tabular}{@{}|l|r|@{}}
\hline
\textbf{Partes del Informe} & \multicolumn{1}{c|}{\textbf{Calificación}} \\ \hline
Introducción                & /10                                        \\ \hline
Datos y Cálculos            & /20                                        \\ \hline
Análisis de Resultados      & /45                                        \\ \hline
Conclusiones                & /20                                        \\ \hline
Referencia y Apéndice       & /5                                         \\ \hline
Total                       & /100                                       \\ \hline
\end{tabular}%
\hfill
{\scshape
\begin{tabular}{@{}c@{}}
\authorname \\ \classno \\ \instructor \\ \today
\end{tabular}}

\end{titlepage}

\end{document}

Note that you shouldn't pass the pdftex option to the class or to the graphicx package. I used demo because I don't have the logos, remove it.

enter image description here

4
  • \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[spanish]{babel} \begin{tabular}{@{}|l|r|@{}} {\scshape I'm wondering what these do. I see that Bernard's suggestion also adds the accents to spanish words but doesn't change the language of \today. I am assuming that the accents are available because of \usepackage[utf8]{inputenc} ? Thank you for your help. Feb 16, 2015 at 1:35
  • 1
    The accents are available mainly because of the T1 encoding of the font. Btw, you should use Latin Modern(package lmodern), which is T1 encoded, and not the default Computer Modern if you use a language with accented letters, or you'll have problems with hyphenation.
    – Bernard
    Feb 16, 2015 at 1:44
  • What changed the language of the date to spanish? Feb 16, 2015 at 1:52
  • 1
    The "Spanish" option in the Babel package. Feb 16, 2015 at 4:57
3

I propose to use booktabs and cellspace to improve the look and spacing of your tabular. Don't puut it in a table environment since it doesn't float.

\documentclass[pdftex,12pt,letterpaper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[pdftex]{graphicx}
\usepackage{booktabs}
\usepackage{cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}

\newcommand{\labno}{3}
\newcommand{\labtitle}{Fuerzas Hidrostaticas}
\newcommand{\authorname}{Author 1 \\ Author 2 \\ Author 3 \\ Author 4}
\newcommand{\instructor}{Instructor}
\newcommand{\classno}{Laboratorio INGE4010}

\begin{document}
\begin{titlepage}

  \noindent
  \includegraphics[width=0.15\textwidth]{uprm_logo.jpg}%
  \begin{minipage}[b]{0.7\textwidth}
    \centering
    Universidad de Puerto Rico \\
    Recinto de Mayaguez\\
    Departamento de Ingenieria Mecanica
  \end{minipage} %
  \includegraphics[width=0.15\textwidth]{logo_upr.png}

  \vspace*{\stretch{7}}
  \begin{center}
    \textsc{Laboratorio \#\labno \ \labtitle}
  \end{center}
  \vspace{\stretch{6}}

  \vfill

  \noindent
  \begin{minipage}{.2\textwidth}%
    \begin{tabular}{@{}Slr@{}}
      \toprule
      \textbf{Partes del Informe} & \textbf{Calificación} \\
      \midrule
      Introducción & /10 \\
      Datos y Cálculos & /20 \\
      Análisis de Resultados & /45 \\
      Conclusiones & /20 \\
      Referencia y Apéndice & /5 \\
      Total & /100 \\
      \bottomrule
    \end{tabular}
  \end{minipage} %
  \hfill
  \begin{minipage}{0.7\textwidth} %
    \begin{flushright}
      \textsc{\authorname \\[1ex] \classno \\[1ex] \instructor \\[1ex] \today}
    \end{flushright}
  \end{minipage}
  %
\end{titlepage}

\end{document} 

enter image description here

2
  • That worked great, I am wondering what these do: \setlength\cellspacetoplimit{3pt} \setlength\cellspacebottomlimit{3pt} I initially thought they would make the space between the margins less but when I run it in Tex the margins look exactly the same as all other suggestions and my own. Thank you for your suggestions. Feb 16, 2015 at 1:36
  • 1
    No: they ensure a minimal vertical spacing between a row and the above and below rows. You surely already noticed tables in LaTeX generally have a very tight vertical spacing.
    – Bernard
    Feb 16, 2015 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.