-
Notifications
You must be signed in to change notification settings - Fork 407
Allow custom argument to compilation on the fly #2836
Description
Good afternoon! I am enjoying vimtex so far (for several years now). It has been very helpful to my work.
Is your feature request related to a problem? Please describe it.
Currently I am posting problem sets, and thereafter, adding the solutions right after each question.
By using a tex macro (using xparse), the solutions can be shown or hidden, as defined by the \jobname.
-
To generate the questions with the solutions, simply append
-solnto thejobname, i.e.!latexmk % -jobname=%:r-soln
-
To show only the questions, compile as per usual (using
:VimtexCompile).
The tex macro in the preamble handles this:
\usepackage{xstring}
\IfEndWith*{\jobname}{-soln}{%
% Solution environment
\NewDocumentEnvironment{solution}{O{\textit} +b}%
{\par #1{Solution:} #2}{}
}{%
% Empty Solution environment
\NewDocumentEnvironment{solution}{+b}{}{}
}When compiled, this produces <file>.pdf, or <file>-soln.pdf, depending on the \jobname.
Describe the solution you'd like
Would there be a way to add an argument such as -jobname=%:soln on-the-fly? One possibility is to allow :VimtexCompile to take in arguments, ie. :VimtexCompile -jobname=%:r-soln, which would pass the jobname argument to g:vimtex_compiler_latexmk.
Describe alternatives you've considered
- The option
g:vimtex_compiler_latexmkcould be modified, but the added argument becomes permanent, which is undesirable for a questions only output. - Currently I am using the shell command
!latexmk % -jobname=%:r-soln, but the shell output quickly clutters the vim window after this is run.
Additional context
Neovim 0.8, lualatex.