Math & ScienceCircuitikz and AMSmath

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
niklz
Posts: 9
Joined: Sun Jan 24, 2010 9:51 pm

Circuitikz and AMSmath

Post by niklz »

Hi there,
I would like to use Circuitikz to draw circuit diagrams for a project report. However, it seems to conflict with amsmath, which I also need for the report.
Does anyone else know why this is, and a work around?
Running win7, TXC, MikteX
here's my code

Code: Select all

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{amsbsy}
%\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage[sectionbib,round]{natbib}
\usepackage{hyperref}
\usepackage{subfig}
\usepackage{rotating}
\usepackage{braket}\usepackage[siunitx]{circuitikz}
\usepackage{tikz}
\begin{document}
\begin{figure}[htbp]%
\begin{center}
\subfloat[Series RLC Circuit]{\label{fig:seriesrlc}
\begin{circuitikz}[scale=1.2]\draw
(0,0)to[sV=$V_0\sin(\omega t)$, i^>=$I_s$] (0,2) -- 
(0,2)to[C=$C$] (2,2) -- 
(2,2)to[L=$L$] (2,0) --
(2,0)to[R, l_=$R$] (0,0)
;\end{circuitikz}
}
\subfloat[Parallel RLC Circuit]{\label{fig:parallelrlc}
\begin{circuitikz}[scale=1.2]\draw
(0,0)to[sV=$V_0\sin(\omega t)$, i^>=$I_p$] (0,2)  
(1,2)to[C=$C$,i>^=$I_C$,*-*] (1,0) 
(1,0)to[short] (3,0) 
(2,2)to[L=$L$,i>^=$I_L$,*-*] (2,0)
(0,0)to[short] (1,0)
(3,2)to[R=$R$,i>^=$I_R$,*-*] (3,0)
(0,2)to[short] (3,2)
;\end{circuitikz}
}
\end{center}
\caption{Resonant RLC Circuits: \protect\subref{fig:seriesrlc} Series RLC configuration. \protect\subref{fig:parallelrlc} Parallel RLC configuration}
\label{fig:rlcres}
\end{figure}
\end{document}
It works when amsmath is commented out, but not when it isn't.
Thanks in advance

kind regards,

niklz

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Circuitikz and AMSmath

Post by gmedina »

Hi,
niklz wrote:...It works when amsmath is commented out, but not when it isn't...
I just did a test and your code worked OK in my system even when amsmath was loaded. Perhaps your LaTeX systemm is using outdated packages? Add \listfiles just before \documentclass{article}
to your example code, compile it and then search the generated .log file for the section *File List*; in it you'll find a list of the packages used and their versions. Here's my *File List* after compilation of your code (with amsmath included):

Code: Select all

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
fancyhdr.sty    
setspace.sty    2000/12/01 6.7 Contributed and Supported LaTeX2e package
  amsbsy.sty    1999/11/29 v1.2d
  amsgen.sty    1999/11/30 v2.0
 amsmath.sty    2000/07/18 v2.13 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsopn.sty    1999/12/14 v2.01 operator names
amsfonts.sty    2009/06/22 v3.00 Basic AMSFonts support
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2009/08/28 v1.8 graphics configuration of TeX Live
  pdftex.def    2010/02/14 v0.04n Graphics/color for pdfTeX
  psfrag.sty    1998/04/11 v3.04 PSfrag (MCG)
  natbib.sty    2009/11/07 8.31a (PWD, AO)
hyperref.sty    2010/02/08 v6.80e Hypertext links for LaTeX
kvsetkeys.sty    2010/01/28 v1.8 Key value parser (HO)
infwarerr.sty    2007/09/09 v1.2 Providing info/warning/message (HO)
etexcmds.sty    2010/01/28 v1.3 Prefix for e-TeX command names (HO)
pdfescape.sty    2007/11/11 v1.8 Provides hex, PDF name and string conversions 
(HO)
pdftexcmds.sty    2009/12/12 v0.7 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty    2009/04/17 v1.2 Provides the ifluatex switch (HO)
 ltxcmds.sty    2010/01/28 v1.2 LaTeX kernel commands for general use (HO)
   ifpdf.sty    2010/01/28 v2.1 Provides the ifpdf switch (HO)
  ifvtex.sty    2008/11/04 v1.4 Switches for detecting VTeX and its modes (HO)
 ifxetex.sty    2009/01/23 v0.5 Provides ifxetex conditional
 hycolor.sty    2009/12/12 v1.6 Color options of hyperref/bookmark (HO)
xcolor-patch.sty    2009/12/12 xcolor patch
letltxmacro.sty    2008/06/24 v1.3 Let assignment for LaTeX macros (HO)
  pd1enc.def    2010/02/08 v6.80e Hyperref: PDFDocEncoding definition (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable integer calculations (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
kvoptions.sty    2009/12/08 v3.6 Keyval support for LaTeX options (HO)
     url.sty    2006/04/12  ver 3.3  Verb mode for urls, etc.
  bitset.sty    2007/09/28 v1.0 Data type bit set (HO)
bigintcalc.sty    2007/11/11 v1.1 Expandable big integer calculations (HO)
atbegshi.sty    2009/12/02 v1.10 At begin shipout hook (HO)
 hpdftex.def    2010/02/08 v6.80e Hyperref driver for pdfTeX
atveryend.sty    2010/01/25 v1.4 Hooks at very end of document (HO)
rerunfilecheck.sty    2010/01/25 v1.3 Rerun checks for auxiliary files (HO)
uniquecounter.sty    2009/12/18 v1.1 Provides unlimited unique counter (HO)
  subfig.sty    2005/06/28 ver: 1.3 subfig package
 caption.sty    2010/01/09 v3.1m Customizing captions (AR)
caption3.sty    2010/01/14 v3.1m caption3 kernel (AR)
rotating.sty    2009/03/28 v2.16a rotated objects in LaTeX
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
  braket.sty    
circuitikz.sty    2009/11/18 The CircuiTikz circuit drawing package version 0.2
.3
    tikz.sty    2008/02/13 v2.00 (rcs-revision 1.27)
     pgf.sty    2008/01/15 v2.00 (rcs-revision 1.12)
  pgfrcs.sty    2008/02/20 v2.00 (rcs-revision 1.21)
  pgfrcs.code.tex
 pgfcore.sty    2008/01/15 v2.00 (rcs-revision 1.6)
  pgfsys.sty    2008/02/07 v2.00 (rcs-revision 1.31)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2008/01/23  (rcs-revision 1.6)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v2.00 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v2.00 (rcs-revision 1.1)
  pgffor.sty    2007/11/07 v2.00 (rcs-revision 1.8)
  pgffor.code.tex
    tikz.code.tex
 xstring.sty    2009/06/05 v1.5c String manipulations (C Tellechea)
 siunitx.sty    2010/02/21 v1.4b A comprehensive (SI) units package
 xkeyval.sty    2008/08/13 v2.6a package option processing (HA)
 xkeyval.tex    2008/08/13 v2.6a key=value parser (HA)
   array.sty    2008/09/09 v2.4c Tabular extension package (FMi)
  xspace.sty    2006/05/08 v1.12 Space after command names (DPC,MH)
si-prefix.cfg    2010/02/21 v1.4b siunitx: SI Multiple prefixes
si-named.cfg    2010/02/21 v1.4b siunitx: SI Named units
 si-addn.cfg    2010/02/21 v1.4b siunitx: SI Additional units
si-prefixed.cfg    2010/02/21 v1.4b siunitx: SI Prefixed units
si-accepted.cfg    2010/02/21 v1.4b siunitx: SI Accepted units
si-physical.cfg    2010/02/21 v1.4b siunitx: SI Physically-measured units
 si-abbr.cfg    2010/02/21 v1.4b siunitx: Abbreviated units
  ts1cmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions
supp-pdf.mkii
 nameref.sty    2010/01/25 v2.36 Cross-referencing by name of section
refcount.sty    2008/08/11 v3.1 Data extraction from references (HO)
gettitlestring.sty    2009/12/18 v1.3 Cleanup title references (HO)
       a.out
       a.out
    umsa.fd    2009/06/22 v3.00 AMS symbols A
    umsb.fd    2009/06/22 v3.00 AMS symbols B
 ***********
If you are using outdated packages, update them. If that was not the problem, please attach to your next post the complete .log file obtained after compilation of your document when the error was produced.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
niklz
Posts: 9
Joined: Sun Jan 24, 2010 9:51 pm

Re: Circuitikz and AMSmath

Post by niklz »

Hi, thanks for reply.

Here's my logfile. I updated my packages when trying to get circuitikz to work. So i dont think it will be that.


Thanks

niklz
Attachments
circuitikz.log
(37.58 KiB) Downloaded 335 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Circuitikz and AMSmath

Post by localghost »

The cause might be that you gave the source file the name of the package. Never name sources like this.


Best regards
Thorsten
niklz
Posts: 9
Joined: Sun Jan 24, 2010 9:51 pm

Re: Circuitikz and AMSmath

Post by niklz »

Changing the name did not resolve the issue. :(
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Circuitikz and AMSmath

Post by localghost »

As gmedina already assumed, you have to update the circuitikz package. Generally you should keep your LaTeX system up to date.
niklz
Posts: 9
Joined: Sun Jan 24, 2010 9:51 pm

Re: Circuitikz and AMSmath

Post by niklz »

Thanks so much, I did the foolish mistake of assuming the owners website would be up-to-date.

Sorry

niklz
Post Reply