1

I can run the following code without any issue in TeXstudio with the Tex Live distribution.

\documentclass{article}
 \usepackage[utf8]{inputenc}
 \usepackage[european]{circuitikz}
 \usepackage{tikz}
    \usetikzlibrary{shapes, calc, intersections}
 \usepackage{pgfplots}
 \pgfplotsset{compat=1.14}
    \usetikzlibrary{pgfplots.groupplots}
 \usepackage{siunitx}
 \usepackage{amsmath}
 \usepackage{amssymb}
 \usepackage{amsfonts}
 \usepackage{subcaption}
 \renewcommand*{\j}{\mathrm{j}}
 \begin{document}
 \begin{figure}[h]
        \begin{tikzpicture}[trim axis right, remember picture]
            \begin{semilogxaxis}[
                name=mag,
                width=\linewidth,
                height=0.5\linewidth,
                ylabel=$20\log_{10}\left(|H\!(\j2\pi f)\right|)$,
                %xlabel=$f\,/\,\si{\Hz}$,
                xmin=1000, xmax=1e10,
                grid=both, minor grid style=dotted, minor y tick num = 4,
                xticklabels={}]

            \addplot [thick, name path=mag] table[x=Magnitude X, y=Magnitude Y, col sep=comma] {bode.csv};
            \draw[red, thick, name path=0dB] (axis cs:1e3,0) -- (axis cs:1e10,0);
            \path [name intersections={of=mag and 0dB,by={intmag}}] (intmag) \pgfextra{\pgfplotspointgetcoordinates{\pgfpointanchor{intmag}{center}} \xdef\myx{\pgfkeysvalueof{/data point/x}}\typeout{\myx}};
            \end{semilogxaxis}

            \begin{semilogxaxis}[
                name=phase,
                at={($(mag.south) - (0,0.05\linewidth)$)},
                anchor=north,
                width=\linewidth,
                height=0.5\linewidth,
                xmin=1000, xmax=1e10,
                xlabel=$f\,/\,\si{\Hz}$,
                ylabel=$\arg\{H(\j2\pi\omega)\}$,
                grid=both, minor grid style=dotted, minor y tick num = 4]

                \addplot [thick, name path= phase] table[x=Phase X, y=Phase Y, col sep=comma] {bode.csv};
                \draw[red, thick, name path= PM] (axis cs:1e3,0) -- (axis cs: 1e10,0) coordinate (pmend);
            \end{semilogxaxis}
            \path [draw, name intersections={of=mag and 0dB,by={intmag}}, name path=vertical] (intmag) coordinate (IM) -- (IM|-phase.south);
            \draw [latex-latex, name intersections={of=vertical and PM, by={intpm}}] (intpm) -- (intpm|-pmend) node[midway, left] {$PM$};
        \end{tikzpicture}
        \caption{Closed-loop Bode plot without Miller compensation}
    \end{figure}
\end{document}

But if I try to run it on Overleaf it fails. This is the output log. bode.csv can be found here

  • 4
    The packages on overleaf are older - if I should guess I would suspect the older pgfplots version. – Ulrike Fischer Dec 18 '18 at 13:19
  • From this comment the TeX Live version you use on Overleaf seems to depend on when the project was created. It may be that Overleaf now has a new version, but your project is using an older TL image. (I don't know how to make the project pick up a newer version. Maybe someone from Overleaf can answer that.) – Nicola Talbot Dec 18 '18 at 15:40
  • 1
    (Disclaimer: I'm a support personnel at Overleaf) OL staff can change the TeX Live version of a project from our end, but at present the versions of circuitikz and pgf on OL servers is still too old to support your code. Sorry about this! – LianTze Lim Dec 19 '18 at 2:12
  • Are you planning to update pgfplots version? I believe it was released in April – jagjordi Dec 19 '18 at 13:08
  • Is this issue solved? How? – Mensch Jun 11 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.