thomasjo / atom-latex

Compile LaTeX or knitr documents from within Atom
https://atom.io/packages/latex
MIT License
223 stars 42 forks source link

Magic TeX comments are not interpreted in TikZ files #444

Closed raimund-schluessler closed 6 years ago

raimund-schluessler commented 6 years ago

Magic TeX comments are not interpreted in TikZ files. If I have a TikZ file and set the TeX comment to % !TEX root = main.tex in order to have the main file being compiled, after starting the compilation I get the output The file does not appear to be a valid source file.

If I rename the Tikz file to *.tex, the TeX comment works. This used to be different in previous versions of the package, but I don't know when exactly this broke. Was this change by accident or intentional?

Please also see the minimal (not) working example. If you rename tikz to tex, the main file will be compiled when starting compilation on the external file.

MWE: file main.tex:

\documentclass[]{article}

\usepackage{pgfplots}

\begin{document}
Magic TeX comments are not interpreted in TikZ files.

\input{external.tikz}

\end{document}

file external.tikz:

%   !TEX root = main.tex
\begin{tikzpicture}

\draw [-,style=-, line width=0.5mm] (0,0) -- ++(8,0);

\end{tikzpicture}%
thomasjo commented 6 years ago

This was definitely not an intentional change. Although, it was never really something that we intentionally supported, so this is not covered by any automated tests or otherwise.

Which LaTeX language package are you using? Does it correctly classify .tikz files as LaTeX?

raimund-schluessler commented 6 years ago

I use three LaTeX related packages:

language-latex in version 1.1.1 latexer in version 0.3.0 and of course this package here in version 0.49.0

Disabling the other packages does not change anything (besides that the Ctrl+Alt+B shortcut does not work anymore and I have to chose build manually from the menu).

The TikZ file is recognized as LaTeX, the shortcut also works on this file.

I use Atom 1.23.0-beta1.