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

\BLOCK do not work inside the \input{another_latex_file.tex} #29

Open
zzakeer opened this issue Nov 25, 2019 · 1 comment
Open

\BLOCK do not work inside the \input{another_latex_file.tex} #29

zzakeer opened this issue Nov 25, 2019 · 1 comment

Comments

@zzakeer
Copy link

zzakeer commented Nov 25, 2019

i have multiple latex file so thats a reason.
report_base.tex hold multiple latex file.
for example.
report_base.tex contains :

\begin{document}
\input{\VAR{report_dir}titlepage.tex}
\end{document}

====================================================
titlepage.tex contains :

\section{Project Overview}
\label{sec:proj-overview}
\begin{xltabular}[l]{\linewidth}{cXcX}
\rowcolor{\colorthG} ID & Vulnerability & Severity Level & Recommendations \\
\BLOCK{ for task, list_of_vulnerabilities in vulnerabilities.items() }
\rowcolor{\colorvul}\multicolumn{4}{c}{\textcolor{white}{\VAR{task}}}\\
\BLOCK{ endfor }
\end{xltabular}

But it gives error.

Screenshot 2019-11-25 at 9 53 01 AM

@kevinvalk
Copy link

TL;DR: What you are doing is not supported

Note: I make a distinction between LaTeX file and LaTeX template.

  • LaTeX template is (my name for) LaTeX interleaved with Jinja2 syntax (like \BLOCK and \VAR), it should be processed by Jinja2 before it becomes a so called "LaTeX file".
  • LaTeX file is (my name for) plain LaTeX that can immediately be parsed by the TeX engine.

What you are doing is including a LaTeX template from a LaTeX file (because I assume you have rendered report_base.tex with Jinja). The TeX engine has no clue what to do with \BLOCK and \VAR, as it is not valid LaTeX code.

An easy but ugly solution would be to render the LaTeX templates to plain TeX and store them in a folder. After that, compile your report_base.tex.

A nicer solution would be rather complex but would probably require to search for \input \include macros in the LaTeX template. Then recursively render all includes and somehow (by saving to disk and changing path??) inject the rendered LaTeX.

There are more solutions obviously, but these are I think the two most attainable ones.

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