Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to place two mini pages next to each other, one with text, one with an image. But my code has them spaced really far apart. How can I bring them together horizontally. I've tried \hspace between the minipages and that doesn't work. It's apart of a much bigger document. Here is everything I'm working with:

\documentclass[twocolumn,12pt,mysize]{article}
\usepackage[normalem]{ulem}
\usepackage{longtable}
\usepackage{multicol}
\usepackage{colortbl}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{midpage}
\usepackage{float}

\begin{document}

\begin{table}[ht]
\begin{minipage}{.65\textwidth}
    \begin{tabular}{*{1}{p{0.65\textwidth}}}
\large\textbf{Peter Parker,}\\
\large\textbf{Spiderman}\\\normalsize 
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\\
\end{tabular}
\end{minipage}%
\begin{minipage}{.65\textwidth}
    \begin{tabular}{*{1}{p{0.65\textwidth}}}
\includegraphics[width=5cm]{../spiderman.jpg}
\\
\end{tabular}
\end{minipage}% 
\end{table}
\begin{document}

Too much space between the text and image

share|improve this question

1 Answer 1

up vote 7 down vote accepted

A minipage is just a box so it will be positioned the same way as A and you can control the space between them the same way as two A eg A\hspace{1cm}A will put 1cm between them.

Your example has two minipages of width .65\textwidth so they can not fit on a line.

neither minipage is necessary as tabular and \includegraphics also make boxes so you can just place those side by side without the minipage.

Alternatively you can lose the tablular and just use a minipage. Also since your document is using twocolumn you want to use table* to get a page-width float.

enter image description here

\documentclass[twocolumn,12pt]{article}
\usepackage[normalem]{ulem}
\usepackage{longtable}
\usepackage{multicol}
\usepackage{colortbl}
\usepackage{hyperref}
\usepackage[demo]{graphicx}
\usepackage{midpage}
\usepackage{float}

\begin{document}

\begin{table*}[htp]
\begin{minipage}[b]{\dimexpr\linewidth-5.5cm\relax}
\large\textbf{Peter Parker,}\\
\textbf{Spiderman}

\normalsize
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{minipage}\hfill
\includegraphics[width=5cm]{../spiderman.jpg}

\end{table*}

\noindent X\dotfill X

\end{document}
share|improve this answer
    
How would you vertically align the image with the top of the text? –  jc_os Jun 6 '13 at 20:03
    
@jc_os change the minipage from [b] to t and then use \raisebox (or easier the adjustbox pacakge to move the reference point of teh image to its top instead of the bottom. –  David Carlisle Jun 6 '13 at 20:06
    
For some reason both the text and the image are appearing half way down the page. DO you know how to move it to the top? –  jc_os Jun 6 '13 at 20:23
    
@jc_os Presumably that is a float page, the default setting for a float page is to vertically centre. you can set \@dblfptop to 0pt to make it come to the top, but better is not to worry about it until you have finished the document LaTeX can not find a good place for a float if there is not much text to float around. –  David Carlisle Jun 6 '13 at 20:25
    
Thank you for all your help! If I could ask one more question: how would you control the horizontal length of the text if I wanted to make that shorter? –  jc_os Jun 6 '13 at 20:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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