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.
\documentclass[11pt, a4paper]{article}
\usepackage{fullpage}
\usepackage{circuitikz}
\usepackage{enumerate}
\usepackage{SIunits}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}[h]
\centering
\begin{subfigure}[t]{0.3\textwidth}
\centering
\begin{circuitikz}[ scale=1.2, american voltages]\draw
 (0,0) -- (3,0) to[short, -o](3,0)
 (0,1.5) to [R, l=$10 \kilo \ohm$] (3,1.5) to[short, -o](3,1.5)
 (3,1.5) to [open, v = $V_c$] (3,0)
 (0,0) to [V, l=$V_i$] (0,1.5)
 ;\end{circuitikz}
 \caption{Steady State Capacitor}\label{Steady State Capacitor}
 \end{subfigure}

 \begin{subfigure}[t]{0.3\textwidth}
 \centering
 \begin{circuitikz}[ scale=1.2, american voltages]\draw
 (0,0) -- (3,0) to[short, -o](3,0)
 (0,1.5) to [R, l=$10 \kilo \ohm$] (3,1.5) to[short, -o](3,1.5)
 (3,1.5) to [open, v = $V_c$] (3,0)
 (0,0) to [V, l=$V_i$] (0,1.5)
 ;\end{circuitikz}
 \caption{Steady State Capacitor}
 \end{subfigure}
 \end{figure}
 \end{document}
share|improve this question
    
@SašoŽivanović please either post an answer, or vote to close :) –  cmhughes Feb 23 '13 at 17:19
add comment

1 Answer

The empty line between the two subfigure environments created a paragraph between them. If you want the figures to be displayed side by side, there should be no paragraph; you will probably want some space.

So, to put the figures side by side, you could simply delete the empty line between them. The figures would still be separated by a space, since for TeX, a newline (but not a double newline) is the same as a space.

Below, I have however put a % on the line dividing the subfigures. I did this for a psychological effect: it is easier for the author to find the break between the figures. (% is a comment character for TeX, thus it does nothing but preventing TeX from seeing an empty line and making a paragraph there.)

\documentclass[11pt, a4paper]{article}
\usepackage{fullpage}
\usepackage{circuitikz}
\usepackage{enumerate}
\usepackage{SIunits}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}[h]
\centering
\begin{subfigure}[t]{0.3\textwidth}
\centering
\begin{circuitikz}[ scale=1.2, american voltages]\draw
 (0,0) -- (3,0) to[short, -o](3,0)
 (0,1.5) to [R, l=$10 \kilo \ohm$] (3,1.5) to[short, -o](3,1.5)
 (3,1.5) to [open, v = $V_c$] (3,0)
 (0,0) to [V, l=$V_i$] (0,1.5)
 ;\end{circuitikz}
 \caption{Steady State Capacitor}\label{Steady State Capacitor}
 \end{subfigure}
 %
 \begin{subfigure}[t]{0.3\textwidth}
 \centering
 \begin{circuitikz}[ scale=1.2, american voltages]\draw
 (0,0) -- (3,0) to[short, -o](3,0)
 (0,1.5) to [R, l=$10 \kilo \ohm$] (3,1.5) to[short, -o](3,1.5)
 (3,1.5) to [open, v = $V_c$] (3,0)
 (0,0) to [V, l=$V_i$] (0,1.5)
 ;\end{circuitikz}
 \caption{Steady State Capacitor}
 \end{subfigure}
 \end{figure}
 \end{document}

If you want to control the (horizontal) spacing between the circuits, you can use various LaTeX's commands: e.g. \quad qill make a "quadraple" space. The general command is \hspace, e.g. \hspace{1.1cm} will put 1.1cm of space between the circuits.

Note that if you need to be really precise, you have to take care that no "extra" space gets in your line: the usual trick is to use a percent % sign to end the line (remember, for TeX, a single newline is the same as a space). Thus, the following would put precisely 1.1cm of horizontal space between the circuits:

 ...
 \end{subfigure}%
 \hspace{1.1cm}%
 \begin{subfigure}[t]{0.3\textwidth}
 ...
share|improve this answer
    
Thanks! Works like a charm! –  Charles Feb 23 '13 at 18:24
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.