Once again i have a nasty problem i could not get rid of so far. Since i know no better place to post this (i cannot really localise the problem), i will try in this section

So what i would like to do is drawing electronic circuits and other stuff in an convenient way in combination with Latex. Searching the internet, i found the M4 - macro compiler [1] and appropriate macros for electric circuits [2].
Together with an pic-interpreter [3] the macro files (.m4) first get converted to a .pic file which again the interpreter dpic then converts to a .tex file that may be included into a latex document. This is also illustraed on page in two [2].
Now to the problem:
I installed the dpic interpreter as well as the M4 "compiler" as well as the M4 circuit macros as described in the according README files.
The test of the installation was successful, it works to start with an .m4 file, process this file with m4 and afterwards with dpic to get a latex file.
The process of conversion which results in an .dvi file happens by typing the following commands to the cmd shell of windows:
(where ex07.m4 is the source file to be processed taken from the examples directory of the m4 circuit macro zip file)
Code: Select all
m4 C:\_LocalLatex\tex\latex\Circuit_macros\pstricks.m4 C:\_LocalLatex\tex\latex\Circuit_macros\libcct.m4 ex07.m4 > ex07.pic
dpic -p ex07.pic > ex07.tex
latex Dok.tex
What i want to do next is to get rid of typing in these few lines everytime i want to "compile" a new drawing, so it would be nice to get this conversion process into the Latex source (as i already mentioned - i use auctex, just for the case that this might be a problem

How one can do the conversion on tex - source level is also described in [2] as the last point of possible simplifications on page 4.
The writer there says, that this would work by defining a new latex command as follows:
Code: Select all
\newcommand\mtopgf[1]{\immediate\write18{m4 <path>/pgf.m4 #1.m4 | dpic -g > #1.tex}}%
C:\_LocalLatex\tex\latex\Circuit_macros\
I have set all the Path variables as described and also tried to call latex with the --shell-escape postfix, which is obviously needed to allow the \write18 operation.
But when i start the Latex compilation process, it gives me the following error(s)
Code: Select all
! Undefined control sequence.
<write> m4 C:\_LocalLatex\tex
\latex \Circuit _macros\pgf .m4 ex07.m4 | dpic...
l.3 \mtopgf{ex07}
! Undefined control sequence.
<write> m4 C:\_LocalLatex\tex \latex
\Circuit _macros\pgf .m4 ex07.m4 | dpic...
l.3 \mtopgf{ex07}
! Undefined control sequence.
<write> m4 C:\_LocalLatex\tex \latex \Circuit
_macros\pgf .m4 ex07.m4 | dpic...
l.3 \mtopgf{ex07}
! Undefined control sequence.
<write> ...lLatex\tex \latex \Circuit _macros\pgf
.m4 ex07.m4 | dpic -g > ex...
l.3 \mtopgf{ex07}
So it must have to to with a problem Latex has with this defined \newcommand.
I know, this is a quite long post, hopefully i have not forgotten something importnat , otherwise please let me know.
It would be wonderful if someone had a good idea, what i could try next

Kind regards,
Franz
[1] : http://www.gnu.org/software/m4/
[2] : ftp://www.dante.de/tex-archive/graphics ... /CMman.pdf
[3] : https://ece.uwaterloo.ca/~aplevich/dpic/