GeneralCan't get minipages to work

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
offroad
Posts: 17
Joined: Mon Feb 18, 2013 5:06 am

Can't get minipages to work

Post by offroad »

Hi all

I've been trying, without any success, to use 'minipages' to align 2 pictures and a text between them, just like the attached file below.

Could any of you shed some light on this?

I'm running MikTeX on Windows 8 with pdflatex. All pictures are in the pdf format.

Any help is very much appreciated

Offroad
Attachments
p1_cropped.pdf
(2.62 KiB) Downloaded 432 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Can't get minipages to work

Post by Johannes_B »

You could post a minimal working example to show us what you got. It's just easier to help you.

Please use the Code Button. You can verify, that your example is compilable by clicking on Open in WriteLaTeX.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
offroad
Posts: 17
Joined: Mon Feb 18, 2013 5:06 am

Can't get minipages to work

Post by offroad »

Johannes_B wrote:You could post a minimal working example to show us what you got. It's just easier to help you.

Please use the Code Button. You can verify, that your example is compilable by clicking on Open in WriteLaTeX.
I found an example online and manage to adapt to my needs. The problem is that it won't use the full width of the page. I uploaded a minimal working example along with its resulting pdf file.

Code: Select all

\documentclass[12pt,a4paper]{report}
\usepackage{graphicx,graphics}
\usepackage[cm]{fullpage}
\usepackage[top=2.0cm, bottom=3.5cm, left=3.4cm, right=2.0cm]{geometry}
\begin{document}
\thispagestyle{empty}
\begin{figure}[htb]
	\begin{center}
		\begin{minipage}[b]{0.2\linewidth}
			\begin{center}
				\includegraphics[width=60pt,height=53pt]{ufrn.pdf}
			\end{center}
		\end{minipage}
		\begin{minipage}[b]{0.7\linewidth}
			\begin{center}
			{\small \bf Name of the university\\[5pt]
			Name of the Research team\\[5pt]
			Graduation Programme in Engineering}
			\end{center}
		\end{minipage}
		\begin{minipage}[b]{0.2\linewidth}
			\begin{center}
				\includegraphics[width=53pt,height=53pt]{ppgeq.pdf}
			\end{center}
		\end{minipage}
	\end{center}
\end{figure}
{\LaTeX} is based on the philosophy that authors should be able to focus on the content of what they are writing without being distracted by its visual presentation. In preparing a LaTeX document, the author specifies the logical structure using familiar concepts such as chapter, section, table, figure, etc., and lets the LaTeX system worry about the presentation of these structures. It therefore encourages the separation of layout from content while still allowing manual typesetting adjustments where needed. This is similar to the mechanism by which many word processors allow styles to be defined globally for an entire document or the use of Cascading Style Sheets to style HTML.

{\LaTeX} can be arbitrarily extended by using the underlying macro language to develop custom formats. Such macros are often collected into packages, which are available to address special formatting issues such as complicated mathematical content or graphics. Indeed, in the example below, the align environment is provided by the amsmath package.
\end{document}
Thank you very much!
Attachments
UFRN.pdf
the output
(10.97 KiB) Downloaded 409 times
ppgeq.pdf
the picture on the right
(279.19 KiB) Downloaded 414 times
uni.pdf
the picture on the left
(327.8 KiB) Downloaded 489 times
uni.tex
the teX file - minimal working example
(1.8 KiB) Downloaded 498 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Can't get minipages to work

Post by Stefan Kottwitz »

It's too wide, since if you add the widths of the minipages you will get 1.1\linewidth.
  • Reduce the minipage width
  • Add a % after a minipage, so the line break doesn't act as white space
  • Use \centering instead of a center environment within the minipage environments, to not get additional vertical space
  • Don't use a figure environment, since you don't want it to float, also you don't need a caption
  • Use \bfseries instead of the obsolete LaTeX 2.09 command \bf
Improved Code:

Code: Select all

\begin{center}
	\begin{minipage}[b]{0.15\linewidth}
		\centering
		\includegraphics[width=60pt,height=53pt]{ufrn.pdf}
	\end{minipage}%
	\begin{minipage}[b]{0.7\linewidth}
		\centering
		{\small \bfseries Name of the university\\[5pt]
		Name of the Research team\\[5pt]
		Graduation Programme in Engineering}
	\end{minipage}%
	\begin{minipage}[b]{0.15\linewidth}
		\centering
		\includegraphics[width=53pt,height=53pt]{ppgeq.pdf}
	\end{minipage}
\end{center}
Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Can't get minipages to work

Post by localghost »

You don't need so many {minipage} environments. Insert some stretchable white space to fill the entire line. For the inner alignment the {minipage} environment accepts optional parameters.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}

\begin{document}
  \noindent
  \rule{4cm}{2.25cm}
  \hfill
  \begin{minipage}[b][2.25cm][t]{0.25\textwidth}
    \centering
    Line 1\\
    Line 2
  \end{minipage}
  \hfill
  \rule{4cm}{2.25cm}
\end{document}
Remarks:
  • Do not use the fullpage package. It does settings in the background which are not documented and can cause trouble. Use geometry to set up page and paper dimensions.

Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
offroad
Posts: 17
Joined: Mon Feb 18, 2013 5:06 am

Re: Can't get minipages to work

Post by offroad »

It worked like a charm.

Thank you very much!

Márcio
Post Reply