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

Idea: Add pdfLaTeX template to external tools plugin #661

Open
spixi opened this issue Jun 6, 2022 · 3 comments
Open

Idea: Add pdfLaTeX template to external tools plugin #661

spixi opened this issue Jun 6, 2022 · 3 comments

Comments

@spixi
Copy link

spixi commented Jun 6, 2022

The external tools plugin adds support to run external commands. It already has some templates like a Build command, which runs make or a Remove trailing spaces command which removes whitespace characters from the document using sed.

I wrote that little script to enable pdfLaTeX integration. This template could be added as default.

#!/bin/sh
if test "$PLUMA_CURRENT_DOCUMENT_TYPE" = "text/x-tex"; then
	OUTFILE=`pdflatex -interaction=nonstopmode -halt-on-error $PLUMA_CURRENT_DOCUMENT_PATH | grep "Output written" | cut -d" " -f4`
	exec xdg-open $OUTFILE
fi
@andrewfowlie
Copy link

Looks good, though how about latexmk to handle bibtex etc?

@spixi
Copy link
Author

spixi commented Jul 6, 2023

Looks good, though how about latexmk to handle bibtex etc?

I have never used latexmk. It sounds like a good idea, but requires more preparation. I know that you sometimes have to call pdflatex multiple times when you use packages like hyperref (or packages which depend on hyperref, like beamer). I personally prefer biber, because it has more features like full Unicode support and the related= key, but bibtex is also fine. Feel free to expand the script to grep the pdflatex output for messages like "Package biblatex Warning: Please (re)run Biber on the file" if you want.

@andrewfowlie
Copy link

Something like the following,

#!/bin/sh
if test "$PLUMA_CURRENT_DOCUMENT_TYPE" = "text/x-tex"; then
  (
    cd $PLUMA_CURRENT_DOCUMENT_PATH
    latexmk 
  )
fi

a user could customize the build behavior through a .latexmkrc file in their $PLUMA_CURRENT_DOCUMENT_PATH directory or through a global rc file in their $HOME directory. latexmk automatically takes care running bibtex, pdflatex multiple times etc etc.

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

No branches or pull requests

2 participants