sleepymalc / VSCode-LaTeX-Inkscape

✍️ A way to integrate LaTeX, VS Code, and Inkscape in macOS
https://pbb.wtf/posts/VSCode-LaTeX-Inkscape/
MIT License
332 stars 21 forks source link

Inkscape Figure Manager errors when trying to create pdf-tex files #20

Closed ColtWhitley closed 1 year ago

ColtWhitley commented 1 year ago

I am trying to get the latex file manager part to work but creating a file will generate the .svg but with error out on the creation of the .pdf and .pdf_tex file types. The following is the error displayed:

Screenshot 2023-01-16 at 3 09 52 PM

If anyone has a solution please let me know :)

sleepymalc commented 1 year ago

Does this repeatedly happen if you do that again? Due to some unknown reasons, the inkscape file manager will fail to create all three files at once in the first cold-run. So maybe just cmd+z and try to trigger that shortcut again?

ColtWhitley commented 1 year ago

It does repeatedly happen if I try and retrigger the shortcut, the number of dateline != NULL errors increases every successive time I try

sleepymalc commented 1 year ago

That error should not be fatal in any sense, I think. Have you tried to update all your packages?

ColtWhitley commented 1 year ago

Everything is up to date, so I don't know where the error is coming in. Can I configure the shortcuts to use the .svg instead of the .pdf_tex file?

sleepymalc commented 1 year ago

Have you rebooted your computer and then tried this on a clean project? And if this doesn't work, then maybe try to run this via the terminal first to see whether everything is correctly installed. p.s. do not forget to first runt watch command.

ColtWhitley commented 1 year ago

I just rebooted and this is the clean project, I also am getting the same error on the terminal when I try to run it. I made sure to use the watch command first. I am stumped on this one

sleepymalc commented 1 year ago

Have you tried to modify the files and save them? I mean, those three files will only be created whenever the file manager export it to $\LaTeX$, so if you only create the file and do nothing (e.g., hasn't modified it and save it), then it will not export anything and hence will only leave you with that .svg.

ColtWhitley commented 1 year ago

Update it doesn't work the first time I try on the command line, but also doesn't error, its not until the second time that I try and create a figure that errors occur

Screenshot 2023-01-16 at 4 26 02 PM
sleepymalc commented 1 year ago

Update it doesn't work the first time I try on the command line, but also doesn't error, its not until the second time that I try and create a figure that errors occur Screenshot 2023-01-16 at 4 26 02 PM

This error shouldn't affect anything since I get it all the time (well, I should try to fix it, but I haven't been able to do that). Please try to modify the file and save it, as I said, and see whether that works.

ColtWhitley commented 1 year ago

I just tried to modify and save the files and it is unfortunately still not populating properly in the figures folder, or elsewhere that I can see

sleepymalc commented 1 year ago

Can you provide a short video demonstrating the whole process or at least some screenshots? It's extremely difficult to debug in this way. In particular, show that it correctly watch the file, it can create the template .svg, the terminal output, the directory structure, and the saving process after modifying.

ColtWhitley commented 1 year ago

Here is my process, I have Inkscape figures installed in a venv, which I make sure to activate first and then go through the process of watching, creating, and then modifying and saving before trying to recompile the LaTeX file. I am using your note template as the default for the document and start on a fresh lecture page with not other Lecter files being compiled

https://user-images.githubusercontent.com/75457827/212785745-b2b4eff2-a6e9-403e-ae5f-5682c272fa33.mov

sleepymalc commented 1 year ago

I think there are some problems with watch. Usually, when you save files, it'll do some exporting steps and there will be some icons pop up in your dock:

https://user-images.githubusercontent.com/60427058/212786556-669fa2e4-3f17-4e11-a9c3-89dcfffb5f2e.mov

Have you followed everything (including modifying the inkscapefigures folder?) And I just noticed, it appears to be that when you set-up the watch correctly, when you create the file, it'll automatically export for you, so you really should see all three files at once,

ColtWhitley commented 1 year ago

I have modified the files in the Inkscapefigures folder, I just tried recopying all of the files from your repo into the Inkscape-figures file and still no luck. Additionally I just went over the tutorial for configuring the Inkscape figure manager and didn't see anything I missed after making sure to read it slowly. Is there anyway I can look at any logs created from the watch command?

sleepymalc commented 1 year ago

A quick test is to watch twice: if it's triggered correctly, then you should see something like this:

image

Other than that, I don't think there's a way to see that.

ColtWhitley commented 1 year ago

I get this error, but I have to watch multiple times before the error occurs. I tried to see if the number of times was constant but it varies from 4-6 times I can watch before the unable to lock onto the pidfile error occurs

sleepymalc commented 1 year ago

Hmm, then that's weird. Then after you get that error, can you create files and export correctly?

ColtWhitley commented 1 year ago

No the same issue happens where the .svg file is generated but no other files :(

ColtWhitley commented 1 year ago

In case the OS/hardware is making a difference I am running Ventura 13.1 on an M1 Macbook pro

sleepymalc commented 1 year ago

In case the OS/hardware is making a difference I am running Ventura 13.1 on an M1 Macbook pro

That's what I'm using currently, so that shouldn't be a problem. I guess it might be something tricker: such as the python environment or something like that. Does your modification of inkscapefigures is exactly the one used by your terminal? Triggering a shortcut in VS Code sends the command into the default VS Code terminal, and that might not be the same as what you had used to test (though both of them seem to fail...) To be honest I have no idea why this is the case since my Inkscape is also up to date.

ColtWhitley commented 1 year ago

I only have Inkscapefigures installed in one place on this computer, which is in that virtual environment so I will try to restart computer again and see if anything else works but I need to step away from debugging for a bit. Thank you for your help and I will let you know if I make any progress. Out of curisosity for the vscode settings are those in your global settings or in a workspace setting?

sleepymalc commented 1 year ago

Everything is global, but what is in this repo is just a part of my settings specific for Inkscape figures.

ColtWhitley commented 1 year ago

I got some new errors today so perhaps these hold a clue:

(LaTeXenv) coltwhitley@Colts-MacBook-Pro Winter2023 % inkscape-figures create test3 /Users/coltwhitley/Documents/CalPoly/Winter2023/ComplexAnalysisII/LectureNotes/Fig
ures/ 
(LaTeXenv) coltwhitley@Colts-MacBook-Pro Winter2023 % 
(org.inkscape.Inkscape:4847): GLib-CRITICAL **: 09:09:21.488: g_date_time_format: assertion 'datetime != NULL' failed

(org.inkscape.Inkscape:4847): GLib-CRITICAL **: 09:09:21.489: g_date_time_format: assertion 'datetime != NULL' failed

(org.inkscape.Inkscape:4847): GLib-CRITICAL **: 09:09:21.489: g_date_time_format: assertion 'datetime != NULL' failed

(org.inkscape.Inkscape:4847): GLib-CRITICAL **: 09:09:21.490: g_date_time_format: assertion 'datetime != NULL' failed
Shortcut::add_shortcut: duplicate shortcut found for: <Primary>comma  Old: app.preferences  New: app.transform-scale(0.5) !
1   HIToolbox                           0x00000001aa3c85c8 _ZN15MenuBarInstance22EnsureAutoShowObserverEv + 120
2   HIToolbox                           0x00000001aa3c8188 _ZN15MenuBarInstance14EnableAutoShowEv + 60
3   HIToolbox                           0x00000001aa3358bc _ZN15MenuBarInstance21UpdateAggregateUIModeE21MenuBarAnimationStylehhh + 1184
4   HIToolbox                           0x00000001aa3c8004 _ZN15MenuBarInstance19SetFullScreenUIModeEjj + 180
5   AppKit                              0x00000001a41be008 -[NSApplication _setPresentationOptions:instance:flags:] + 956
6   AppKit                              0x00000001a4053bb0 -[NSApplication _updateFullScreenPresentationOptionsForInstance:] + 404
7   CoreFoundation                      0x00000001a0c75570 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
8   CoreFoundation                      0x00000001a0d13054 ___CFXRegistrationPost_block_invoke + 88
9   CoreFoundation                      0x00000001a0d12f9c _CFXRegistrationPost + 440
10  CoreFoundation                      0x00000001a0c46b74 _CFXNotificationPost + 708
11  Foundation                          0x00000001a1b3472c -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
12  AppKit                              0x00000001a41be58c spacesNotificationHandler + 96
13  SkyLight                            0x00000001a58a84dc _ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ + 896
14  SkyLight                            0x00000001a5bd44c4 _ZN21CGSDatagramReadStream26dispatchMainQueueDatagramsEv + 228
15  SkyLight                            0x00000001a5bd43c0 ___ZN21CGSDatagramReadStream15mainQueueWakeupEv_block_invoke + 28
16  libdispatch.dylib                   0x00000001a0a189dc _dispatch_call_block_and_release + 32
17  libdispatch.dylib                   0x00000001a0a1a504 _dispatch_client_callout + 20
18  libdispatch.dylib                   0x00000001a0a28d1c _dispatch_main_queue_drain + 928
19  libdispatch.dylib                   0x00000001a0a2896c _dispatch_main_queue_callback_4CF + 44
20  CoreFoundation                      0x00000001a0cc1d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
21  CoreFoundation                      0x00000001a0c7f7d0 __CFRunLoopRun + 2036
22  CoreFoundation                      0x00000001a0c7e888 CFRunLoopRunSpecific + 612
23  HIToolbox                           0x00000001aa353fa0 RunCurrentEventLoopInMode + 292
24  HIToolbox                           0x00000001aa353de4 ReceiveNextEventCommon + 672
25  HIToolbox                           0x00000001aa353b2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
26  AppKit                              0x00000001a3f00424 _DPSNextEvent + 632
27  AppKit                              0x00000001a3eff5b4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
28  libgdk-3.0.dylib                    0x0000000106030314 poll_func + 220
29  libglib-2.0.0.dylib                 0x0000000103fbcb50 g_main_context_iterate + 424
30  libglib-2.0.0.dylib                 0x0000000103fbcc74 g_main_context_iteration + 116
31  libgio-2.0.0.dylib                  0x0000000103db07d4 g_application_run + 528
32  inkscape                            0x0000000102fca6c8 main + 7272
33  dyld                                0x00000001a0877e50 start + 2544
1   HIToolbox                           0x00000001aa35390c _ZN15MenuBarInstance22RemoveAutoShowObserverEv + 44
2   HIToolbox                           0x00000001aa3c8fbc _ZN15MenuBarInstance15DisableAutoShowEv + 36
3   HIToolbox                           0x00000001aa3c90b0 _ZN15MenuBarInstanceD2Ev + 128
4   HIToolbox                           0x00000001aa3c8ee0 _ZN15MenuBarInstance7ReleaseEv + 56
5   AppKit                              0x00000001a455b5ec -[NSHIPresentationInstance discard] + 228
6   AppKit                              0x00000001a491ab58 -[_NSFullScreenSpace(PresentationInstance) discardPresentationInstance] + 32
7   AppKit                              0x00000001a491abb0 -[_NSFullScreenSpace(PresentationInstance) activateFullScreenPresentationOptions] + 64
8   AppKit                              0x00000001a4774c20 -[_NSExitFullScreenTransitionController _doSucceededToExitFullScreen] + 40
9   AppKit                              0x00000001a47756f8 __63-[_NSExitFullScreenTransitionController _performExitFullScreen]_block_invoke + 236
10  libxpc.dylib                        0x00000001a091222c _xpc_connection_reply_callout + 124
11  libxpc.dylib                        0x00000001a091211c _xpc_connection_call_reply_async + 88
12  libdispatch.dylib                   0x00000001a0a1a584 _dispatch_client_callout3 + 20
13  libdispatch.dylib                   0x00000001a0a38710 _dispatch_mach_msg_async_reply_invoke + 344
14  libdispatch.dylib                   0x00000001a0a28c70 _dispatch_main_queue_drain + 756
15  libdispatch.dylib                   0x00000001a0a2896c _dispatch_main_queue_callback_4CF + 44
16  CoreFoundation                      0x00000001a0cc1d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
17  CoreFoundation                      0x00000001a0c7f7d0 __CFRunLoopRun + 2036
18  CoreFoundation                      0x00000001a0c7e888 CFRunLoopRunSpecific + 612
19  HIToolbox                           0x00000001aa353fa0 RunCurrentEventLoopInMode + 292
20  HIToolbox                           0x00000001aa353c30 ReceiveNextEventCommon + 236
21  HIToolbox                           0x00000001aa353b2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
22  AppKit                              0x00000001a3f00424 _DPSNextEvent + 632
23  AppKit                              0x00000001a3eff5b4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
24  libgdk-3.0.dylib                    0x0000000106030314 poll_func + 220
25  libglib-2.0.0.dylib                 0x0000000103fbcb50 g_main_context_iterate + 424
26  libglib-2.0.0.dylib                 0x0000000103fbcc74 g_main_context_iteration + 116
27  libgio-2.0.0.dylib                  0x0000000103db07d4 g_application_run + 528
28  inkscape                            0x0000000102fca6c8 main + 7272
29  dyld                                0x00000001a0877e50 start + 2544
sleepymalc commented 1 year ago

Just to be save, what are the versions of python and Inkscape you're using?

ColtWhitley commented 1 year ago

I am running Inkscape 1.2.2 and python 3.9.6

sleepymalc commented 1 year ago

That's weird; I'm using the same version for Inkscape, and I don't think the python version makes any difference. I guess your best bet right now will be looking into the source code of the inkscape-figure manager. Sadly, since the original author Gilles Castel died..., so no one is currently maintaining this package.

ColtWhitley commented 1 year ago

I had no idea that he died, that is very sad to hear. I will look into the code, out of curiosity what version of python are you running? since I am running mine in a virtual environment it should be easy to install a different version. I know it shouldn't change but I want to be thorough

sleepymalc commented 1 year ago

I'm using python 3.8.8 via conda.

sleepymalc commented 1 year ago

I come across this issue, which suggests installing fswatch via brew install fswatch for solving weird watch problems. Maybe try this?