Closed philipptempel closed 7 years ago
Thanks a lot for the feedback.
I have actually never tried it on Python 3.5, there may be some incompatibilities I am not aware of. I will check as soon as possible. By the way, how did you install FLaP? Have you used PIP or did you install it from the sources? Have you used a virtual environment for instance?
If I am not mistaken, this occurs when a file is specified as output. As a workaround, I suggest to specify only the directory where you want the merged file to be written. For instance, to get the flat project into a flattened
directory:
$> python -m flap -v source.tex flattened
FLaP will create flattened/merged.tex
.
I will fix this in the next release.
On my Mac, this works (cannot check for Windows, as I - luckily - don't have my office laptop around).
However, now I'm getting the following error
FLaP v0.3.0 -- Flat LaTeX Projects
+ in 'paper.tex' line 24: '\input{includes/packages}'
+ in 'paper.tex' line 27: '\input{includes/commands}'
+ in 'paper.tex' line 30: '\input{includes/tikz-commands}'
+ in 'tikz-commands.tex' line 17: '\input{#3.tikz}'
Error: [Errno 2] No such file or directory: './includes/#3.tikz.tex
That's because I have used xparse to declare a document command like so
\DeclareDocumentCommand{\includetikz}{O{0.75\linewidth} O{0.5625\linewidth} m}{%
\setlength{\figurewidth}{#1}%
\setlength{\figureheight}{#2}%
\input{#3.tikz}%
}
which I am using via \inludetikz{path/to/tikz/file}
inside a figure
-environment as it allows me to more easily add TikZ files into my document. But the line containing input{#3.tikz}
is something flap is tripping over.
Thanks for the feedback.
Unfortunately, FLaP naively matches and replaces patterns into the source files. Here I think we reach the limit of this design, because these text substitutions are context independent: When FLaP spots the \input{#3.tikz}
it does not know that this command is part of a new user-defined command. My guess is that such cases require a proper LaTeX parser/interpreter.
Still, I'll better document this limitation, but I am not sure what workaround we could find.
I close this issue as FLaP v0.4.0 addresses your first comment. I will open a separate issue as for the use of inclusion directives in user-defined commands.
Was looking for a LaTeX flattening script in Python. Found yours. Was very content installing it. But FLaPing my project fails with the following error message
This was performed on Win 7 x64 in a GitBash, but even the regular cmd would fail with the same error message. At first I thought it was due to missing elevated rights on the flap package directory, but after starting GitBash and cmd as admin and testing it there to no avail, I realized that your script is trying to create a file in a folder called
__main__.py
which obviously cannot work as there is no such folder.