Generalsubfigure

LaTeX specific issues not fitting into one of the other forums of this category.
Sam
Posts: 62
Joined: Fri Nov 30, 2007 1:43 pm

subfigure

Post by Sam »

hello, :(

I need to subfigure the following

%\begin{figure}[h!]
% \centering
% \includegraphics [width=0.7\textwidth]{delay_20amp_synch_fr4_submap.eps}
% \caption{Typical subspace map for the synchronous actuators motion(Heave)}
% \label{fig:delay_20amp_synch_fr4_submap.eps}
%\end{figure}
%\begin{figure}[h!]
% \centering
% \includegraphics [width=0.7\textwidth]{delay_fr4_cycle.eps}
% \caption{Time domain response of the two actuators being sinusoidally controlled.}
% \label{fig:delay_fr4_cycle.eps}
%\end{figure}

I tried the folowing but did not work

\begin{figure}[h]
\hfill
\begin{minipage}[t]{.45\textwidth}
\begin{center}
\epsfig{file=delay_20amp_synch_fr4_submap.eps, scale=0.25}
\caption{figure 1}
\label{fig-tc}
\end{center}
\end{minipage}
\hfill
\begin{minipage}[t]{.45\textwidth}
\begin{center}
\epsfig{file=delay_fr4_cycle.eps, scale=0.25}
\caption{figure 2}
\label{fig-tc}
\end{center}
\end{minipage}
\hfill
\end{figure}

Any help will be much apprecitaed 8)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

subfigure

Post by localghost »

You should use the subfig package, which lets you typeset those subfigures in a very comfortable way. Refer to its documentation for more information.

Code: Select all

\documentclass[12pt,DIV15]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[font=footnotesize]{subfig}
\usepackage{graphicx}

\begin{document}
  \section{Short introduction to the \texttt{subfig} package}\label{sec:subfig}
    Figure~\ref{fig:figure} shows how to typeset a figure with two subfigures using the \texttt{subfig} package.

    \begin{figure}[!ht]
      \centering
      \subfloat[Subfigure One\label{subfig-1:figure}]{
        \includegraphics[scale=0.25]{delay_20amp_synch_fr4_submap}
      }
      \subfloat[Subfigure Two\label{subfig-2:figure}]{
        \includegraphics[scale=0.25]{delay_fr4_cycle}
      }
      \caption{A figure with two subfigures}\label{fig:figure}
    \end{figure}

    As you can see, you can easily typeset the Figure~\ref{fig:figure} with the two subfigures \subref*{subfig-1:figure} and \subref*{subfig-2:figure}.
\end{document}
Don't use the epsfig package! It is obsolete and superseded by the graphicx package. You can omit the endings in the file names. The compiler will find the right files on its own. Avoid the "_" in the file names and paths (even if it works). It is reserverd for subscripts in mathematical mode. The caption package lets you customize the captions of figures and tables.


Best regards an welcome on Board
Thorsten
Last edited by localghost on Fri Nov 30, 2007 2:59 pm, edited 2 times in total.
Sam
Posts: 62
Joined: Fri Nov 30, 2007 1:43 pm

Re: subfigure

Post by Sam »

Thnaks a lot!

I tried your code but still does not work :?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: subfigure

Post by localghost »

Sorry for that. My fault. I missed an "s" in the first line and had a wrong label in the second subfigure. I corrected the code. So, please try again. If it still doesn't work, please give a detailed description of the error by posting the message given by the compiler from the log file.
Last edited by localghost on Fri Nov 30, 2007 3:07 pm, edited 1 time in total.
Sam
Posts: 62
Joined: Fri Nov 30, 2007 1:43 pm

Re: subfigure

Post by Sam »

GReat Thanks you are very helpful :)

it did work but HOW can I control the space between the two figures?

also HOW can I Make them exactly lined up?

thx
Last edited by Sam on Fri Nov 30, 2007 3:06 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

subfigure

Post by localghost »

Just put the right command directly between them.

Code: Select all

\begin{figure}[!ht]
  \centering
  \subfloat[Subfigure One\label{subfig-1:figure}]{
    \includegraphics[scale=0.25]{delay_20amp_synch_fr4_submap}
  }
  \hspace{5mm}
  \subfloat[Subfigure Two\label{subfig-2:figure}]{
    \includegraphics[scale=0.25]{delay_fr4_cycle}
  }
  \caption{A figure with two subfigures}\label{fig:figure}
\end{figure}
Sam wrote: also HOW can I Make them exactly lined up?

What do mean with that? They should be vertically aligned to the bottom.
Last edited by localghost on Fri Nov 30, 2007 3:12 pm, edited 1 time in total.
Sam
Posts: 62
Joined: Fri Nov 30, 2007 1:43 pm

Re: subfigure

Post by Sam »

Thanks but

\hspace{0mm} is for the horizontal distance between the fig right?

It did not make a change...I want the figures to be very close to each other and lined up!

Thx :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

subfigure

Post by localghost »

Just set a negative horizontal space.

Code: Select all

\hspace{-1mm}
What do you mean with "lined up"? Vertical alignment to the top of both? They should be aligned to their bottoms.
Sam
Posts: 62
Joined: Fri Nov 30, 2007 1:43 pm

subfigure

Post by Sam »

localghost wrote: Just set a negative horizontal space.

Code: Select all

\hspace{-1mm}
What do you mean with "lined up"? Vertical alignment to the top of both? They should be aligned to their bottoms.



Thnaks!

I meant lined up both horizontally :)
Sam
Posts: 62
Joined: Fri Nov 30, 2007 1:43 pm

Re: subfigure

Post by Sam »

:( they don't line up horizontally!!

How can I sort this out plz :oops:
Post Reply