Open alperyilmaz opened 5 months ago
Hi, Thanks for the template. I was wondering, is it possible to get the output from an existing file in the folder?
A hypothetical example would be:
#term( ps1: [`$`], input: [`ls -la`], output: [filename:"ls-output.txt"], )
Hi! You can read the file using data loading in Typst, and then put the loaded data to the output parameter.
Here I compile the following document:
#import "term.typ": term
#let my_file_content = raw(read("my_file"))
#figure(
term(
ps1: [`$`],
input: [`cat my_file`],
output: my_file_content,
),
caption: [Content of my_file],
)
Beforehand I ran the following command:
echo "Here is the content" > my_file
So the result is the following:
thanks for the detailed answer.. I'm new to typst and I keep forgetting that typst is actually a language. If you don't mind can I ask file and terminal related questions?
ls -alh
for example as input, but the output is actually generated by running it in terminal? If that's easy, then I won't need to keep output of each command I have to demonstrate, I can run them during compile.input
empty in term
. But then I think there's a space left. Is it possible to skip input without leaving a space? Below, I left ps1 and input empty because the command and its output is coming from the file. But then there's blank line on top.thanks for the detailed answer.. I'm new to typst and I keep forgetting that typst is actually a language. If you don't mind can I ask file and terminal related questions?
- Is it possible to have the command
ls -alh
for example as input, but the output is actually generated by running it in terminal? If that's easy, then I won't need to keep output of each command I have to demonstrate, I can run them during compile.- I am writing a book about data analysis in terminal, hence I have lots of code examples in files. But my files have the code and output in the file. So, I need to leave
input
empty interm
. But then I think there's a space left. Is it possible to skip input without leaving a space? Below, I left ps1 and input empty because the command and its output is coming from the file. But then there's blank line on top.
Sorry for the wait.
As far as I know, Typst can't run commands via shell at compile time. You might wanna ask on Typst Github though.
My use case is storing input and output files separately, just like I showed in the previous example.
However what you're saying makes sense. I'd like this template to be more universal and work like carbon. So I'll get rid of three arguments and make it a one.
I just pushed the changes. See examples. Thanks for helping me out!
Hi, Thanks for the template. I was wondering, is it possible to get the output from an existing file in the folder?
A hypothetical example would be: