Graphics, Figures & Tablesmakecirc | Circuit Diagrams with MetaPost

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
TDKBW
Posts: 1
Joined: Sat Nov 24, 2012 3:43 am

makecirc | Circuit Diagrams with MetaPost

Post by TDKBW »

Greetings to All.

I am trying to draw circuit diagrams in MetaPost for inclusion into a LaTeX Document. The package I hope to use is called makecirc. However, I have no experience whatsoever with MetaPost which is causing me troubles.

Can anybody help me use one of their examples? I have installed the package.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

makecirc | Circuit Diagrams with MetaPost

Post by Stefan Kottwitz »

Hi,

welcome to the board!
TDKBW wrote:However, I have no experience whatsoever with MetaPost which is causing me troubles.
So why do you use MetaPost? Was makecirc just the first you found? Would you consider alternative packages? For example, based on the widely used TikZ and PSTricks.
Stefan
LaTeX.org admin
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

makecirc | Circuit Diagrams with MetaPost

Post by shadgrind »

TDKBW wrote:Can anybody help me use one of their examples? I have installed the package.
Sure. Here's how you could make a document that includes the circuit in Figure 6 on page 17 of the MakeCirc-en.pdf documentation file.

1. Create a file called mycircuit.mp with these contents:

Code: Select all

input makecirc;
initlatex("\usepackage{amsmath,amssymb}");
beginfig(0);
resistor.a(origin,normal,90,"R","10\ohm");
inductor.a(R.a.r+(2cm,0),Up,-90,"L","");
centreof.A(R.a.r,L.a.l,cap);
capacitor.a(c.A,normal,phi.A,"C","");
wire(R.a.r,C.a.l,nsq);
wire(C.a.r,L.a.l,nsq);
wire(L.a.r,R.a.l,udsq);
endfig;
end
2. In a terminal window run metapost twice on that file:

Code: Select all

mpost mycircuit.mp
mpost mycircuit.mp
3. Create a LaTeX file called makecirctest.tex:

Code: Select all

\documentclass{article}
\include{graphicx}
\begin{document}
\includegraphics{mycircuit.0}
\end{document}
4. Compile the makecirctest.tex file:

Code: Select all

latex makecirctest.tex
dvips makecirctest.dvi
ps2pdf makecirctest.ps
The result will look like this:
mycircuit.png
mycircuit.png (5.26 KiB) Viewed 4418 times
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
Post Reply