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 am trying to set two figures side by side while using the picture environment instead of includegraphics as shown in most examples here. Unfortunately they are displayed stacked and I do not know what I am doing wrong. Who can help?

\documentclass[10pt,a4paper,landscape,twocolumn]{article}
\usepackage{geometry}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}

\begin{document}

\setlength{\unitlength}{2.0cm}
\begin{figure}
\centering

\begin{subfigure}[b]{0.5\linewidth}
\centering
\begin{picture}(1,2)
\put(0,0){\circle*{0.1}}
\put(0,1){\circle*{0.1}}
\put(1,0){\circle*{0.1}}
\put(1,1){\circle*{0.1}}
\put(0.5,1.75){\circle*{0.1}}
\put(0.5,0.5){\circle*{0.1}}
\thicklines
\put(0,0){\vector(0,1){1}}
\put(0,1){\vector(2,3){0.5}}
\put(0.5,1.75){\vector(2,-3){0.5}}
\put(1,1){\vector(0,-1){1}}
\put(1,0){\vector(-1,0){1}}
\put(0,0){\vector(1,1){0.5}}
\put(0.5,0.5){\vector(1,1){0.5}}
\put(1,1){\vector(-1,0){1}}
\put(0,1){\vector(1,-1){0.5}}
\put(0.5,0.5){\vector(1,-1){0.5}}
\end{picture}
\caption{Euler-Path}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\centering
\begin{picture}(1,2)
\put(0,0){\circle*{0.1}}
\put(0,1){\circle*{0.1}}
\put(1,0){\circle*{0.1}}
\put(1,1){\circle*{0.1}}
\put(0.5,1.75){\circle*{0.1}}
\put(0.5,0.5){\circle*{0.1}}
\thicklines
\put(0,0){\vector(0,1){1}}
\put(0,1){\vector(2,3){0.5}}
\put(0.5,1.75){\vector(2,-3){0.5}}
\put(1,1){\vector(0,-1){1}}
\put(1,0){\vector(-1,1){0.5}}
\put(0.5,0.5){\vector(-1,-1){0.5}}
\end{picture}
\caption{Hammilton-Cycle}
\end{subfigure}

\caption{House of Santa Clause}
\end{figure}

\end{document}
share|improve this question
1  
Just put % after the first \end{subfigure} –  egreg Dec 16 '12 at 10:35
    
Thanks, that also worked. –  hielsnoppe Dec 16 '12 at 12:06
2  
The end of line counts as a space when LaTeX is typesetting a paragraph; see this answer for more information. –  egreg Dec 16 '12 at 12:09
add comment

1 Answer

up vote 2 down vote accepted

You are using to much width for subfigure package. Put the smaller multiplier (for example 0.48) before the \linewidth in \begin{subfigure}[b]{0.5\linewidth} line.

share|improve this answer
1  
Outch, how easy was that!? Thank you. –  hielsnoppe Dec 16 '12 at 10:28
    
@hielsnoppe: No problem! –  m0nhawk Dec 16 '12 at 10:40
add comment

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.