1

I want to include an external tikz-file scaled to size with tikzscale via its version of \includegraphics. However, on top of the picture a lot of garbled paths appear: enter image description here

It looks like \includegraphics tries to guess subpaths (which don´t exist), but somehow prints them. My MWE is:

\documentclass{article}

\usepackage{tikz}
\usepackage{tikzscale}

\graphicspath{{fig/auxiliary/}, {fig/Matlab/}, {fig/Visio/},
{fig/other/}}

\begin{document}

\begin{figure}[tbhp]
\includegraphics{fig/figure1.tikz}
\caption{a}
\end{figure}

\end{document}

The content of windquiver.tikz is:

\begin{tikzpicture}
\draw[->](0,0)--(1,1);
\end{tikzpicture}
  • 1.1*\figureheight looks to be in error (there should be no * ) although I wouldn't expect it to have that effect but without a real example impossible to debug. – David Carlisle Jun 16 '16 at 22:03
  • @DavidCarlisle thanks for your guess. Had already tried it with values like 15cm. Also have used it in this form in other reports before successfully... – Paul Paulsen Jun 16 '16 at 22:22
  • Finally singled out the error. It was a wrong \graphicspath hidden in the depths of the template. Updated the question - please feel free to edit it to make it useful to others. – Paul Paulsen Jun 20 '16 at 10:26
  • @PaulGaborit thanks for the tip. It is wrong though - tikzscale actually depends on this. – Paul Paulsen Jun 20 '16 at 10:27
0

The error is caused by \graphicspath. Like @Dzaic pointed out in a comment, you must not use commata between different paths in the argument of \graphicspath. If you change the MWE to the following form, it works:

\documentclass{article}

\usepackage{tikz}
\usepackage{tikzscale}

\graphicspath{{fig/auxiliary/}{fig/Matlab/}{fig/Visio/}{fig/other/}}


\begin{document}

\begin{figure}[tbhp]
\includegraphics{fig/windquiver.tikz}
\caption{a}
\end{figure}

\end{document}

I am not sure though if all the subdirectories will be looked up for graphics or only the last one. Also note that obviously the graphics paths don´t work - check this question and answer: How to use \graphicspath?

| improve this answer | |
  • @PaulGaborit I am sorry that I mixed up the filenames. Changed it back into windquiver.tikz. However, it does compile without any problems on my machine. You have to make sure the tikz file is in the right subdir (/fig in this case) though. – Paul Paulsen Jun 20 '16 at 12:47
  • 2
    According to the documentation the notation should be without comma: \graphicspath{{fig/auxiliary/}{fig/Matlab/}{fig/Visio/}{fig/other/}} – Dzaic Jun 20 '16 at 13:28
  • @PaulGaborit I am sorry, I don´t know why it doesn´t compile in your case. Please feel free and have a look at the tikzscale documentation or at one of the questions here related to this: tex.stackexchange.com/q/215557/41356, tex.stackexchange.com/q/252992/41356 and so on... – Paul Paulsen Jun 20 '16 at 16:01
  • @Dzaic thanks for the addition. I updated the answer. – Paul Paulsen Jun 20 '16 at 16:02
  • @PaulGaborit did you get it to compile? – Paul Paulsen Jun 22 '16 at 7:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.