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

Magic comments instead of settings for VScode? #8

Closed
gw0 opened this issue Feb 19, 2019 · 3 comments
Closed

Magic comments instead of settings for VScode? #8

gw0 opened this issue Feb 19, 2019 · 3 comments

Comments

@gw0
Copy link
Collaborator

gw0 commented Feb 19, 2019

Currently examples contain .vscode/settings.json with configuration specific for LaTeX-Workshop for VScode. Recently they added support for additional magic commands (issue, docs) similar to what is supported by LaTeXTools for Sublime Text.

For VScode it is now sufficient to add the following magic comments in the header of thesis.tex:

% !TEX program = xelatex
% !TEX options = -aux-directory=./int -include-directory=./FRIteza -include-directory=./int -output-directory=./out -synctex=1 -interaction=nonstopmode -file-line-error "%DOC%"
% !BIB program = bibtex
% !BIB options = -include-directory=./FRIteza "./int/%DOCFILE%"

Unfortunately, the crucial !TEX options and !BIB options are not widely supported (!TEX program and !BIB program are). I am not sure how meaningful is it to replace current VScode configuration with these magic comments until support becomes wider (maybe we could send PRs or open issues for all major editors and tools?).

@itzsimpl
Copy link
Contributor

As you are probably aware the FRIthesis template is designed to follow the five stages of a doctoral dissertation. Each one influences the generated PDF slightly. As of this moment the magic commands do not provide the tools to solve the stage building process in an elegant way, especially since in the press stage one needs to build both thesis.tex and cover.tex. In the latest commit 07032ab in the [WIP] add_stage_parameter branch a special build script is provided to generate the corresponding PDF, depending on the chosen stage. We are currently working on a solution that would be as similar as possible, regardless of the IDE or lack of it (command line, TeXStudio, VScode or Overleaf).

Currently only VScode with the possibility to define specific LaTeX recipes via .vscode/settings.json provides the best tools to have individual recipes for individual stages of the doctoral dissertation. If, however, one chooses to manually specify the stage (by passing the corresponding stage parameter when loading the FRIthesis class file), one could remove the .vscode folder altogether and instead use the latexmk build script. In this case the configuration is specified via a latexmkrc or .latexmkrc file which contains:

$ENV{'TEXINPUTS'}='../:./int/:./out/:';
$ENV{'BSTINPUTS'}='../:./int/:./out/:';
$ENV{'OPENTYPEFONTS'}='.:../:';
$ENV{'TTFONTS'}='.:../:';

$bibtex_fudge=0;

$pdf_mode=1;
$pdflatex="xelatex %O %S";

$out_dir = "./out";
$aux_dir = "./int";
@default_files = ('thesis.tex', 'cover.tex');

Note that this requires MikTeX (support for $aux_dir). By using this config file one can simply build with the default compile recipe, which in VScode is latexmk anyway (default also for Overleaf). As a plus, the command line build is executed just by typing:

$ latexmk thesis

Note that in this case the stage needs to be set in thesis.tex when loading the FRIthesis class. Another possible toolchain might be latexjs, see James-Yu/LaTeX-Workshop#119, which due to time constraints remains untested.

Sending PRs or open issues on all major editors is an idea, but it probably should be such that it will allow for the definition of stage dependant recipes.

@itzsimpl
Copy link
Contributor

itzsimpl commented Mar 1, 2019

FRIteza v2.20190301 supports VScode with LaTeX-Workshop via LaTeX recipes. A configuration for TeXstudio is also provided. Both are based on the latexmk build script. In addition a script is provided to pack all the required files into a single zip to be uploaded to Overleaf. See README.md for further details. Due to time constraints we do not plan to provide support for other IDEs (e.g. Sublime Text).

@itzsimpl itzsimpl closed this as completed Mar 1, 2019
@gw0
Copy link
Collaborator Author

gw0 commented Mar 6, 2019

Thanks, latexmk with stages seems to be the most elegant solution.

If you instead manually specify the stage, this also works with VSCode:

% !TEX program = latexmk
\documentclass[language=english,stage=beta]{FRIteza}

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