Closed mcgoldba closed 4 years ago
I have a similar problem. Where/when should the inkscape watch command be executed?
When you create a figure, the watcher should normally start watching the directory.
What OS you using? What's the content of ~/.config/inkscape-figures/roots
?
What happens when you execute inkscape-figures watch
?
Hello Gilles,
This is what happens when I try to use inkscape-figures, this video also contains what roots looks like and what happens when I execute watch.
Thanks! What I said wasn't correct. Creating a figure doesn't start the file watcher, it merely adds the folder to the list of folders that should be watched. Actually starting the watcher should be done by executing inkscape-figures watch
once. I saw that the first time you executed that command, there was no output (which is expected). The second time you ran it, it gave an error about not being able to lock a pid file. This means that the file watcher is running.
Please edit and save the figure you've just created. I think (and hope) that now the script will compile the figures as expected. Please report back!
Hi Gilles,
Here is a recording of what happens when I run the watcher and create the file
It doesn't seem to be compiling the figure correctly but it is generating the pdf_tex.
After that if I run the watcher again the output is as expected (my vim seems to glitch, but I believe that's unrelated and that usually doesn't happen)
Thanks Gilles! I am not at a place were I can try your last recommendation, but I did look at this some more yesterday. I was able to successfully create the .pdf_tex file and compile the document without any error if I manually went back to vim after Ctrl-f opened inkscape and ran the command
.!inkscape-figures watch
After this I can edit the figure, save it, and compile the document successfully. However, If I recall correctly it requires me to manually call the watch
command every time, and it doesn't work if I run this command before hitting Ctrl-f or running it directly from the console, I get the same 'pid' error (Although I may be wrong on this point). I will look into more tonight.
By the way I am running Ubuntu linux from a Acer chromebook through a crouton.
I get the same result as cuppa with your most recent suggestion. The only way I can get the figure to appear properly is if it implement the watch command after hitting Ctrl-f and before Ctrl-s in inkscape.
Hi Gilles,
Do you have any suggestions for when/how to run the watch command?
Thanks, cup
@mcgoldba Have you come up with a workaround?
Not yet. I haven't had time to look at it recently. I did try to start the watcher with a revised vim mapping for Ctrl-f... but it didn't work. I had something like:
inoremap <C-f> <Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/" && .!inkscape-figures watch'<CR><CR>:w<CR>
What version of inkscape and python are you using? I've added some debugging options to version 1.0.1. You can install it as follows:
pip install inkscape-figures==1.0.1
Now, if you run
LOGLEVEL=DEBUG inkscape-figures watch --no-daemon
you should get some debugging output.
Now, in another terminal, execute
inkscape-figures create "Figure 1"
inkscape-figures edit
and select "Figure 1". Upon saving, the directory should contain "figure-1.pdf_tex" or something similar. Please attach the output of the watch command.
Hi Gilles,
I currently am using python3.7 and am using inkscape version 0.92.3,
Here is the the output of the watch command:
INFO:inkscape-figures:Watching figures.
DEBUG:inotify.adapters:Inotify handle is (3).
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/.cs]
DEBUG:inotify.adapters:Added watch (1): [/home/c-u-poots]
INFO:inkscape-figures:Watching directories: /home/c-tex-example/figures, /home/c-u-p/My_Files/School/223
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/fi
DEBUG:inotify.adapters:Added watch (2): [/home/c-u-p
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/la
DEBUG:inotify.adapters:Added watch (3): [/home/c-u-p
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/Myk 4/figures]
DEBUG:inotify.adapters:Added watch (4): [/home/c-u-pWeek 4/figures]
Here's a video of me using inkscape figures, and the output. https://streamable.com/fecql
It looks like everything is working just fine? Whenever you save the svg, the figure gets recompiled and the pdf_tex
/pdf
files get created. Is there still something that doesn't work as expected or has your problem been solved?
I am using Inscape 0.91 r13725.
Here is the output:
INFO:inkscape-figures:Watching figures.
DEBUG:inotify.adapters:Inotify handle is (4).
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/.config/inkscape-figures/roots]
DEBUG:inotify.adapters:Added watch (1): [/home/mcgoldba/.config/inkscape-figures/roots]
INFO:inkscape-figures:Watching directories: /home/mcgoldba/summer2019/ucsd_fund_ml/test/figures, /home/mcgoldba/summer2019/gt_dsn_opt/lecturenotes/module5/figures, /home/mcgoldba, /home/mcgoldba/test/figures, /home/mcgoldba/summer2019/gt_dsn_opt/mynotes/figures
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/summer2019/ucsd_fund_ml/test/figures]
DEBUG:inotify.adapters:Added watch (2): [/home/mcgoldba/summer2019/ucsd_fund_ml/test/figures]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/summer2019/gt_dsn_opt/lecturenotes/module5/figures]
DEBUG:inotify.adapters:Added watch (3): [/home/mcgoldba/summer2019/gt_dsn_opt/lecturenotes/module5/figures]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba]
DEBUG:inotify.adapters:Added watch (4): [/home/mcgoldba]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/test/figures]
DEBUG:inotify.adapters:Added watch (5): [/home/mcgoldba/test/figures]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/summer2019/gt_dsn_opt/mynotes/figures]
DEBUG:inotify.adapters:Added watch (6): [/home/mcgoldba/summer2019/gt_dsn_opt/mynotes/figures]
DEBUG:inotify.adapters:Events received from epoll: ['IN_ACCESS']
DEBUG:inotify.adapters:Events received in stream: ['IN_CLOSE_WRITE']
INFO:inkscape-figures:Recompiling figure-1.svg
DEBUG:inkscape-figures:Running command:
DEBUG:inkscape-figures:inkscape --export-area-page --export-dpi 300 --export-pdf /home/mcgoldba/figure-1.pdf --export-latex /home/mcgoldba/figure-1.svg
DEBUG:inkscape-figures:Command succeeded
DEBUG:inotify.adapters:Events received from epoll: ['IN_ACCESS']
DEBUG:inotify.adapters:Events received in stream: ['IN_CLOSE_WRITE']
DEBUG:inkscape-figures:File has changed, but is nog an svg
DEBUG:inotify.adapters:Events received in stream: ['IN_CLOSE_WRITE']
DEBUG:inkscape-figures:File has changed, but is nog an svg
It seems that the .pdf_tex file is created correctly in this casea, and when I run within vim using the
When I run inkscape-figures watch, in a terminal somewhere else, and then start editing my document and adding figures it works! I believe I have the same behavior as mcgoldba as if I don't have inkscape-figures watchin running somewhere, the pdf_tex is not generated.
I get the similar problem in the latest version 1.0.4 and solve it by edit the insert map in the tex.vim as following:inoremap <C-f> <Esc>: silent exec '.!inkscape-figures create "'.getline('.') .'" "'.b:vimtex.root.'/figures/";inkscape-figures watch'<CR><CR>:w<CR>
It seems that this is equivalent to the condition that we type the watch command after creating and before closing the inkscape.
Hope this comment can solve someone's problem.
Closing this issue as it looks like it is working for most people. If anyone still has similar problems, feel free to open a new issue.
After hitting Ctrl-F on a line with the figure name in my .tex file, steps 1 thru 5 execute properly, but the file watcher (step 6) does not run immediately after opening the .svg template, Vimtex returns a compile error
The :VimtexCompileOutput is:
Where is the "inkscape-figures watch" command executed? Should this be added to the vim mapping?