Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create extension for synctex #75

Closed
ghost opened this issue Dec 22, 2015 · 16 comments
Closed

Create extension for synctex #75

ghost opened this issue Dec 22, 2015 · 16 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Dec 22, 2015

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
Copy link
Collaborator

akerbos commented Dec 29, 2015

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
Copy link
Author

ghost commented Dec 29, 2015

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
Copy link
Collaborator

akerbos commented Dec 30, 2015

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
Copy link
Author

ghost commented Dec 30, 2015

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.

@ghost ghost closed this as completed Dec 30, 2015
@akerbos akerbos changed the title synctex Create extension for synctex Dec 30, 2015
@akerbos akerbos reopened this Dec 30, 2015
@akerbos
Copy link
Collaborator

akerbos commented Dec 30, 2015

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 pushed a commit that referenced this issue Jan 1, 2016
Implements issue #75: SyncTeX is now supported with a dedicated extension.
@akerbos akerbos added this to the Release 1.0 milestone Jan 1, 2016
@akerbos akerbos self-assigned this Jan 1, 2016
@akerbos
Copy link
Collaborator

akerbos commented Jan 1, 2016

@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
Copy link
Author

ghost commented Jan 1, 2016

Its works perfectly fine! Thank you so much!

@akerbos
Copy link
Collaborator

akerbos commented Jan 1, 2016

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

@akerbos akerbos closed this as completed Jan 1, 2016
@ghost
Copy link
Author

ghost commented Jan 1, 2016

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
Copy link
Collaborator

akerbos commented Jan 1, 2016

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
Copy link
Author

ghost commented Jan 4, 2016

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
Copy link
Collaborator

akerbos commented Jan 4, 2016

-----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 [email protected] 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:
#75 (comment)
-----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
Copy link
Author

ghost commented Jan 4, 2016

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 %

  • replace /Applications/ltx2any/ to wherever it is installed
  • -lf raw without the raw option for the logfile, error/warning display of TeXStudio will not work

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

screen shot 2016-01-04 at 13 03 33

@reitzig
Copy link
Owner

reitzig commented Jan 4, 2016

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
Copy link
Author

ghost commented Jan 4, 2016

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
Copy link
Collaborator

akerbos commented Jun 14, 2016

@samcarter8 Done, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants