I get error messages that don't make sense running code which I've adapted from https://ftp.acc.umu.se/mirror/CTAN/graphics/circuit_macros/doc/Circuit_macros.pdf. I've rewritten the code with the built-in text editor in Ubuntu the "Text Editor" to be sure that I don't have hidden tokens from the copy/paste process and I have no tabs in the file. It worked once, don't know how. Should I re-install TexLive? I've been running other Tikz stuff with no problem.

LaTeX Warning: Writing file `./['.

LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help.

l.4 \begin{filecontents*}[n


When I rerun it I get the same missing \begin{document}complaint and it always error indicates the options bracket in \filecontents. If I delete the offending option it complains about the next. It also gives me a warning:

LaTeX Warning: File `[' already exists on the system. Not generating it from this source.

\newcommand\mtotex[2]{\immediate\write18{m4 #2.m4 | dpic -#1 > #2.tex}}
elen = 0.75
Origin: Here
    source(up_ elen); llabel(-,v_s,+)
    resistor(right_ elen); rlabel(,R,)
        capacitor(down_ to (Here,Origin))
    line right_ elen*3/3
    inductor(down_ Here.y-Origin.y); rlabel(,L,);b_current(i)
    line to Origin

   \caption{customized caption}
  • 2
    What is the output of pdflatex '\stop'? You probably has an older version of LaTeX that doesn't support the optional argument in filecontents Commented May 16, 2022 at 20:45
  • pdflatex '\stop' This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode LaTeX2e <2017-04-15> Babel <3.18> and hyphenation patterns for 84 language(s) loaded. No pages of output. Transcript written on texput.log. Commented May 17, 2022 at 3:19
  • 1
    The options to filecontents were introduced in 2019-10-01, so your version of LaTeX doesn't support them. You need to update (or use the filecontents package and \begin{filecontents*}, to get the same behaviour as [noheader,force]). Commented May 17, 2022 at 10:31
  • @PhelypeOleinik You were right. Reinstalled. Now it complains ((/usr/local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-dvips.def) (./testQ.aux) (/usr/local/texlive/2022/texmf-dist/tex/context/sample/common/sample.tex ! Undefined control sequence. l.4 \starttext It came when I changed \begin{filecontents*}[noheader,force]{sample1.m4} to \begin{filecontents}[overwrite,noheader,nosearch]{sample1.m4} I had error: ```) Runaway argument? ! File ended while scanning use of ^^M. <inserted text> \par Commented May 18, 2022 at 12:07
  • 1
    You seem to be executing a ConTeXt example file context/sample/common/sample.tex. That won't work in LaTeX... Commented May 19, 2022 at 10:27


You must log in to answer this question.

Browse other questions tagged .