#show rules in external file
12 messages · Page 1 of 1 (latest)
You can't import show rules directly, but you can create a function that takes some content and applies the rules to it. For example, in one file you have
#let red-text(content) = {
show text: set text(red)
content
}
then you import that function in another file and just write
#red-text[Hi there]
thanks!
so how i can implement something like this?
#show raw.where(block: true): it => {
set align(left)
set block(fill: luma(240), inset: 10pt, radius: 4pt)
it
}
#let my-codeblock(code) = {
show raw.where(block: true): it => {
set align(left)
set block(fill: luma(240), inset: 10pt, radius: 4pt)
it
}
code
}
and then
#my-codeblock[
keys_list = ['A', 'B', 'C']
values_list = ['blue', 'red', 'bold']
#There are 3 ways to convert these two lists into a dictionary
#1- Using Python's zip, dict functionz
dict_method_1 = dict(zip(keys_list, values_list))
```
]
oops hold on
well I cant properly display it, but you get the idea
like this
got it thanks!
I have another question, how i can work with multiple files for writing and merge them using main?
just write #include 'file.typ' and everything that is dispalyed in file will be displayed here as well
thanks again main you are a life-saver!
#include "file.typ"