General ⇒ Custom LaTeX command to run a script?
Custom LaTeX command to run a script?
I'm using LaTeX to write confidential documents who must be shared by different contributors.
Some confidential info are system passwords that must not be accessible by some contributors.
For security reason, I want to remove secrets from the shared document. I would like to use vaultproject.io to store secrets with access level and write a custom command for my LaTeX document able to retrieve infos from Vault or return a default content if the secret isn't available for the current contributor.
Dealing with vault is my problem, what I need and don't know is how to write a custom command in LaTeX who run a external tool with arguments taken from the doc (the secret ID) and return a content to display.
(regarding security advices, be aware that I trust the local system, this request is not to avoid password in clear text, it's to avoid password in clear text accessible to specific contributors in collaborative writing process)
Cheers
Yoann
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Custom LaTeX command to run a script?
external tools can be run with the so-called \write18 feature, or using a pipe:ygini wrote: Dealing with vault is my problem, what I need and don't know is how to write a custom command in LaTeX who run a external tool with arguments taken from the doc (the secret ID) and return a content to display.
Code: Select all
\documentclass{article}
\newcommand*\sstring{article.cls}
\begin{document}
% method \write18 and redirect:
\immediate\write18{kpsewhich \sstring > \jobname.xin}% requires \write18 feature enabled,
% TL usually uses --shell-escape switch, MikTeX --enable-write18 AFAIR
% the result of the system call (here kpsewhich) will be redirected to file \jobname.xin
\InputIfFileExists{\jobname.xin}{%
\typeout{`\jobname.xin' has been read.}}{%
\typeout{`\jobname.xin' could not (yet) be found.}}%
% a little more direct---piping method:
\input{|"kpsewhich \sstring"}% requires piping feature enabled,
% TL usually uses --shell-escape switch, MikTeX --enable-pipe ... or was it --enable-piping?
\end{document}
You can use
Code: Select all
pdflatex --help
KR
Rainer