reitzig / ltx2any

Yet another LaTeX build wrapper, with one or two nifty features
GNU General Public License v3.0
59 stars 4 forks source link

Create extension for synctex #75

Closed ghost closed 8 years ago

ghost commented 8 years ago

When using your great tool with e.g. texstudio the ability of synctex is however lost - probably because the relevant files are located in the tmp folder. It would be nice to add a option to enable synctex a) by passing it as an argument to the tex call and b) to copy back *.synctex.gz files

akerbos commented 8 years ago

ad a) This should already be possible using the -ep parameter.

ad b) The easiest way to integrate this would probably be an extension. Unfortunately, extensions currently run only after the first engine run. This will have to change (cf issue #58); after that, it should be easy to write such an extension.

Until then, try using -ep and open the PDF from the tmp folder with texstudio.

ghost commented 8 years ago

Thanks for your quick replay! I tested your suggestions and it works, both passing the arguments to tex and opening the pdf from the tmp directory ... kind-of. When posting my wish I did not consider that synctex would point to tex files in the tmp folder, which is kind of useless. So I think it is probably not a good idea to use synctex together with a tool, that copies its files to a temporary directory. Can ltx2any by any chance be used without tmp directory?

Einen Guten Rutsch ins neue Jahr!

akerbos commented 8 years ago

True, opening the files in tmp is not very useful. If you do not use the daemon mode, you can wrap your call to ltx2any in your own script and copy the SyncTeX files out yourself. Full integration will have to wait for more flexible extension interfaces.

Oh, idea: what happens if you create symlinks to the *.synctex.gz files in the main directory? If paths are relative, it might just work! Plus, you wouldn't have to update the symlinks after every run. (Assuming you are using GNU/Linux here.)

Can ltx2any by any chance be used without tmp directory?

No, and that I'll never implement. Keeping the main directory as clean as possible was one of the major requirements I started out with.

ghost commented 8 years ago

Unfortunately, latex uses absolute paths in its synctex file, so a symlink to the synctex file does not help. In case someone else encounters the same problem, one could possible use SED ore something to replace the tmp path inside the synctex file.

But thanks a lot for your ideas, time and effort! I think for now I will stick to latexmk.

akerbos commented 8 years ago

Notes to self:

-ep "--synctex=-1" creates a plain text file. We need to replace all instances of the tmp path with the main path (trivial). Then, gzip and copy to main folder.
This needs to happen after the last engine run.

We want to add an option that turns all of this on; the user should not have to use -ep themselves.

akerbos commented 8 years ago

@samcarter8 Please check if the new option -synctex does what you need. It should put a working job.synctex.gz in your main directory.

ghost commented 8 years ago

Its works perfectly fine! Thank you so much!

akerbos commented 8 years ago

Yay, glad I could help you out this easily! \o/

ghost commented 8 years ago

P.S. in case you will include this option in the README or something, it might be interesting for users that a) it is not necessary to pass the synctex option to latex with -ep "-synctex=-1" because you do this automatically b) it will fail when you manually pass something else like -ep "-synctex=1"

akerbos commented 8 years ago

I did not think documentation was necessary beyond -synctex appearing in the help output. Do you disagree?

ad b) It does? Uh. Ah, I guess pdflatex can't deal with contradictory option?

ghost commented 8 years ago

I saw you already added it to the readme. Thank you! I guess I might be biased, but for people who use your tool not from the command line but from some other tool like e.g. TeXmaker, being able to read the options from there instead of the help output is quite handy.

yes, I tried that unintentionally and got an error message :)

akerbos commented 8 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

I see. I never thought of using the tool not from the CLI. Maybe I should even create a tutorial on how to make TeXstudio (as an example) work with it?

I'll make a note to add documentation for the existing options. Thanks for the feedback!

On January 4, 2016 12:11:45 PM CET, samcarter8 notifications@github.com wrote:

I saw you already added it to the readme. Thank you! I guess I might be biased, but for people who use your tool not from the command line but from some other tool like e.g. TeXmaker, being able to read the options from there instead of the help output is quite handy.

yes, I tried that unintentionally and got an error message :)


Reply to this email directly or view it on GitHub: https://github.com/akerbos/ltx2any/issues/75#issuecomment-168648370 -----BEGIN PGP SIGNATURE----- Version: APG v1.1.1

iQFLBAEBCgA1BQJWilxfLhxSYXBoYWVsIFJlaXR6aWcgKE1vYmlsKSA8cmFwaGFl bEB2ZXJyZWNoLm5ldD4ACgkQQc+KXZuMO/FGJwf/eCFPceuxBD+iHKq9fBqkQ90U JxYXVeDD+QjVTHclluI/dQ5vdlFpRlW6XNN0l6RcWs8UcATAePwqLgS/kh7LpJ68 CYhnySTWnKiDAmddmZGtP+l4HTrpmnvPVa1rXxvQYr3LKvumlYS+UG4oouZmLUok j/7gpQq9dg69HzVXIAJk6eyRbxmdqPFwDwlLtg7fQNP4mEXiccCKk4eXtQXMXsD9 PMqawZplu100TmzDlSiS4Nx1UC7ZPZ4Y3b2jttp0oMlCAhHoD3ze1zVTfeZfmApN c0ABTTRaQELS8ZXoBaD2Q2H9JHW4upPMoVz0IMgddzuk6j9wJiSjIfdzqaF6dg== =pSa8 -----END PGP SIGNATURE-----

ghost commented 8 years ago

Configuring TeXStudio for ltx2any is actually quite easy. All one has to do is open Preferences->Build and

a) add a User Command named ltx2any:ltx2any with the content /Applications/ltx2any/ltx2any -lf raw -synctex %

b) change the Build & View to txs:///ltx2any | txs:///view-pdf.

screen shot 2016-01-04 at 13 03 33

reitzig commented 8 years ago

Thanks, I may use that (with your permission).

Is -lf raw necessary for TeXStudio to report the errors correctly? (Does it do a better job than my parser? I'd be interested in messages mine does not catch correctly.) Have you experimented with the PDF log?

ghost commented 8 years ago

Of course you may use, that why I posted it :)

Exactly. TeXStudio has a build in parser for warning/error and let's you jump to the right file/line etc.

From the few tests I did, your log files found all the errors and the log.pdf is just beautifully typeset! I am just too lazy to open another file when TeXStudio is already displaying the information.

akerbos commented 8 years ago

@samcarter8 Done, thanks!