How do I change the size of raw text?

Hi there :slight_smile:, I’m no expert but based on this Github post I were able to make some examples that hopefully can help you.
Also check out the post itself perhaps, it might explain some of it better than I can.

also it’s a little cumbersome to make “raw code examples” in a reply on this forum because of it already using that formatting :smiley:, so that’s to explain to extra tabs / spaces in the examples.

Isolated raw text example

For a singular code block

#[
  #show raw: set text(size: 20pt)
    ```rust
    fn main() {
      println!("Hello World!");
    }
    ```
]

All raw text transform example

for all raw code in the document/page below this

This should be the code you need for your question specifically. And you can just have this code in main file or similar as you please

    #show raw: r => {
      set text(size: 15pt, purple)
      r
    }
    ```
      fn main() {
        println!("Hello World!");
      }
    ```

Specific raw code-language transform example

This will only affect code/raw blocks of a specific language, in this example “hex”.

  #show raw.where(lang: "hex"): r => {
    set text(size: 20pt, purple)
    show "println!": set text(green)
    r
  }
    
    ```hex
      fn main() {
        println!("Hello World!");
      }
    ```

A function

Missing some lines endings but can be useful for an alternative to in-line-raw text perhaps.

#let textCode = (content) => text(font: "Inconsolata", content)

#textCode([
fn main() {\
  println!("Hello World!");\
}]
)
3 Likes