@@ -50,10 +50,11 @@ popular LaTeX distributions, like [TeX Live](https://www.tug.org/texlive/),
5050Compiling your PDF can be as simple as writing the following task.
5151
5252``` python
53+ from pathlib import Path
5354import pytask
5455
5556
56- @pytask.mark.latex (script = " document.tex" , document = " document.pdf" )
57+ @pytask.mark.latex (script = Path( " document.tex" ) , document = Path( " document.pdf" ) )
5758def task_compile_latex_document ():
5859 pass
5960```
@@ -64,11 +65,24 @@ task module to the LaTeX file and the compiled document.
6465
6566### Dependencies and Products
6667
67- Dependencies and products can be added as with a normal pytask task using the
68- ` @pytask.mark.depends_on ` and ` @pytask.mark.produces ` decorators. which is explained in
69- this
68+ Dependencies and products can be added as usual. Read this
7069[ tutorial] ( https://pytask-dev.readthedocs.io/en/stable/tutorials/defining_dependencies_products.html ) .
7170
71+ For example, with the ` @pytask.task ` decorator. (The choice of the kwarg name, here
72+ ` path ` , is arbitrary.)
73+
74+ ``` python
75+ import pytask
76+ from pytask import task
77+ from pathlib import Path
78+
79+
80+ @task (kwargs = {" path" : Path(" path_to_another_dependency.tex" )})
81+ @pytask.mark.latex (script = Path(" document.tex" ), document = Path(" document.pdf" ))
82+ def task_compile_latex_document ():
83+ pass
84+ ```
85+
7286### Customizing the compilation
7387
7488pytask-latex uses latexmk by default to compile the document because it handles most
@@ -77,8 +91,8 @@ decorator.
7791
7892``` python
7993@pytask.mark.latex (
80- script = " document.tex" ,
81- document = " document.pdf" ,
94+ script = Path( " document.tex" ) ,
95+ document = Path( " document.pdf" ) ,
8296 compilation_steps = " latexmk" ,
8397)
8498def task_compile_latex_document ():
@@ -95,8 +109,8 @@ from pytask_latex import compilation_steps as cs
95109
96110
97111@pytask.mark.latex (
98- script = " document.tex" ,
99- document = " document.pdf" ,
112+ script = Path( " document.tex" ) ,
113+ document = Path( " document.pdf" ) ,
100114 compilation_steps = cs.latexmk(
101115 options = (" --pdf" , " --interaction=nonstopmode" , " --synctex=1" , " --cd" )
102116 ),
@@ -113,8 +127,8 @@ an example for generating a `.dvi`.
113127
114128``` python
115129@pytask.mark.latex (
116- script = " document.tex" ,
117- document = " document.pdf" ,
130+ script = Path( " document.tex" ) ,
131+ document = Path( " document.pdf" ) ,
118132 compilation_steps = cs.latexmk(
119133 options = (" --dvi" , " --interaction=nonstopmode" , " --synctex=1" , " --cd" )
120134 ),
@@ -157,23 +171,24 @@ The following task compiles two latex documents.
157171for i in range (2 ):
158172
159173 @pytask.mark.task
160- @pytask.mark.latex (script = f " document_ { i} .tex " , document = f " document_ { i} .pdf " )
174+ @pytask.mark.latex (
175+ script = Path(f " document_ { i} .tex " ), document = Path(f " document_ { i} .pdf " )
176+ )
161177 def task_compile_latex_document ():
162178 pass
163179```
164180
165181If you want to compile the same document with different command line options, you have
166- to include the latex decorator in the parametrization just like with
167- ` @pytask.mark.depends_on ` and ` @pytask.mark.produces ` . Pass a dictionary for possible
182+ to include the latex decorator in the parametrization. Pass a dictionary for possible
168183compilation steps and their options.
169184
170185``` python
171186for format_ in (" pdf" , " dvi" ):
172187
173188 @pytask.mark.task
174189 @pytask.mark.latex (
175- script = " document.tex" ,
176- document = f " document. { format_} " ,
190+ script = Path( " document.tex" ) ,
191+ document = Path( f " document. { format_} " ) ,
177192 compilation_steps = cs.latexmk(
178193 (f " -- { format_} " , " --interaction=nonstopmode" , " --synctex=1" , " --cd" )
179194 ),
0 commit comments