General ⇒ Can't get minipages to work
Can't get minipages to work
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 453 times
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Can't get minipages to work
Please use the Code Button. You can verify, that your example is compilable by clicking on Open in WriteLaTeX.
Can't get minipages to work
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.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.
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}
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Can't get minipages to work
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 acenter
environment within theminipage
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
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}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Can't get minipages to work
{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}
- 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
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Can't get minipages to work
Thank you very much!
Márcio