I want to use circuit_macros
, a tool for creating circuit diagrams using M4 macros written by Dwight Aplevich. I am using Windows and face problems since most of the avalaible documentation are for UNIX and GNU/Linux users.
I am using Miktex 2.9 with Texmaker 5.0.2 on Windows 8.1. Following the installation instructions, here is what I have done so far:
Downloaded the .exe files of dpic (pic interpreter) from
https://ece.uwaterloo.ca/~aplevich/dpic/Windows/index.html
I've put the two executables filesdpic.exe
andm4.exe
inside a newly-created folder at:C:\dpic
.
Then I added do the Path variable the above-mentioned folder from the "View Advanced System Settings" menu, so that I can execute these programs regardless of the directory inside which I am.Downloaded and installed a m4 macro interpreter.
Still according to Aplevich's instructions on the repository, one may download a program from the sourceforge website at:
http://gnuwin32.sourceforge.net/packages/m4.htmDownloaded and unzipped the circuit_macros distribution from CTAN
Decided where to install the .m4 library files
I created the localtexmf folder atC:\localtexmf\tex\latex\circuit_macros
and copied the downloaded unzipped files of the distribution to the target folder.Copied boxdims.sty from the top distribution directory to where LaTeX will find it
In my case, I pasted it to newly-created folder called "boxdims" at:
C:\Users\billyandriam\AppData\Local\Programs\MiKTeX2.9\miktex\tex\latex\boxdims\
.After that, I opened the MikTex console and from the upper-left menus, I clicked on Tasks>Refresh file name database.
Defined the environment variable M4PATH to point to the installation directory determined in Step number 4.
In the Control Panel at "View Advanced System Settings", I created a new environment variable called M4PATH and attributed as its value the following directory:C:\localtexmf\tex\latex\circuit_macros\
.
Now, my installation works with some limitations. When I have a .m4 file and run the appropriate command, the .m4 file converts to .tex with no errors. So, from Windows's command prompt, this is the command I used to create the "filename.tex" file (At the beginning, I put include(pgf.m4)
at the first line of the .m4 because it has to generate a Tikz picture):
m4 filename.m4 | dpic -g > filename.tex
Yet, I cannot invoke m4 and dpic from a latex document directly.
As an illustration, let us consider the following latex code:
\documentclass{article}
\usepackage{tikz}
\newcommand\mtotex[2]{\immediate\write18{m4 #2.m4 | dpic -#1 > #2.tex}}
\begin{document}
\mtotex{g}{filename} %This line should create filename.tex from filename.m4
\input{filename.tex}
\end{document}
For some reasons, typesetting the above MWE returns an error. Did I miss something?