Header and Overwrite files

Hello fellow Mates,

i am using typst for a schoolproject and i have encountered a problem which i have been trying to fix since 2 weeks. So i am asking you guys if there is anyone who can help me, pls do so.

My code looks like this. I have a template file which looks like this

#let sharepoint = "https://htl3r.sharepoint.com/sites/IT-SYT-BS/Freigegebene%20Dokumente"
#let mainPage = "https://www.htlrennweg.at/"
#let fach = "SYT/BS"
#let schoolyear = "2024/25"
#let filename = "00_Erstinstallation";
#let uebungsName = filename.split("_").slice(1).join(" ")
#let uebungsNummer = str.slice(filename, 0, 2)

#let page_template = (
  header: [
    #table(
      columns: (50%, 50%), rows: (90pt), stroke: none, align: (left, right),  
      image("htl3r_logo.jpg"),
      [#link(sharepoint)[
              #text(weight: "bold", size: 1.2em,  fach + ": " + uebungsName)
            ]
            #v(-4mm)
            #text("Ăśbungsblatt " + uebungsNummer)
            #v(-3mm)
            #text(size: 0.9em, "Schuljahr " + schoolyear + " an der")
            #link(mainPage)[
              #text(size: 0.9em, "HTL Wien 3 Rennweg")
            ]
            #v(-3mm)
            #link(mainPage)[
              #text(size: 0.9em, "Rennweg 89b, 1030 Wien")
            ]
            ]
    )
    
    #line(length: 100%)
    #v(-10mm)
  ],
footer: [
    #line(length: 100%)
    #table(
        columns: (50%, 50%), rows:(auto), align: (left, right), stroke: none,
        [#text("Version vom 25. März 2025")],
        [#context [#here().page()]/#context[#counter(page).final().at(0)]]
    ),
]
)

and i have a main file where i import these variables, header and footer
Code Main file

#import "../template.typ": page_template

#set page(width: 210mm, height: 297mm, margin: (top: 10mm, bottom: 20mm, left: 15mm, right: 15mm),header-ascent: -18mm,

header : page_template.header,
  footer : page_template.footer
  )

  #v(35mm)

== A~~~ Zielsetzung

Vorbereitend fĂĽr die folgenden LaborĂĽbungen wollen wir:

- uns mit der Umgebung zur Rechnervirtualisierung im Labor vertraut machen,
- einen ersten virtuellen Computer ("Virtuelle Maschine", VM) selbst "bauen" und
- darauf ein aktuelles Windows (von einer virtuellen Installations-DVD) installieren.

~~~#emph[Bemerkung:] In den folgenden LaborĂĽbungen werden vorbereitete virtuelle Maschinen einfach ~~~kopixert (sog. #emph[Cloning]), damit nicht immer eine Neuinstallation notwendig ist.

Im Anschluss werden einige Kenndaten auf unserem virtuellen PC ermittelt und in einem ersten Labor-Protokoll dokumentiert.


== B~~~ DurchfĂĽhrung

Ihr Übungsprotokoll soll alle notwendigen Schritte zur Durchführung der Übung dokumentieren, sodass eine andere Person anhand des Protokolls die gesamte Übung problemlos später nachvollziehen kann. Die Bewertung erfolgt aufgrund von Korrektheit, Vollständigkeit und Form. Ferner sollte das Protokoll Ihre Antworten auf alle gestellten Fragen enthalten.

#strong[Wichtig:] Sie dürfen sich bei einem allfälligen Interview auf Ihr Protokoll beziehen (#emph[Sie können also während des Betreuergesprächs auch etwas kurz in Ihrem Protokoll nachlesen].


== C~~~ Inbetriebnahme der VM

1. Virtualisierungs-Software (ein sog. Typ-II-Hypervisor) auf dem Host-System starten.

2. Mit der Virtualisierungs-Software (*VMware Workstation*) eine neue VM erstellen:
   - *New Virtual Machine → Custom (Advanced)* auswählen, Betriebssystem später installieren.
   - Betriebssystem: `Microsoft Windows` → `Windows 11 x64`
   - Name der VM nach Standard: `Windows11_Pro_Edu_Nachname_Vorname_UE01`
   - Firmware Type: *UEFI*
   - Hardware-Spezifikationen:
     - *CPU:* 1 Prozessor / 2 Cores
     - *RAM:* 4 GiB
   - *Host-Only* Netzwerkverbindung (keine Internetverbindung fĂĽr schnellere Installation)
   - Neue virtuelle Festplatte (40 GiB, nicht vor-alloziert, dynamisch wachsend)

3. Eine Windows-Installations-DVD als *ISO-Image* in das virtuelle CD/DVD-Laufwerk der VM einlegen.


== D~~~ Registry-Hack zur Installation in VMware

Microsoft setzt hohe Hardwareanforderungen für Windows 11, darunter TPM. Um die Installation in einer VM zu ermöglichen, wird ein Registry-Hack angewendet:

1. VM starten und von der DVD booten.

2. Beim Sprachfenster die Kommandozeile öffnen (`Shift + F10`).

3. *Registrierungseditor* (`regedit`) öffnen und zu `HKEY_LOCAL_MACHINE\SYSTEM\Setup` navigieren.
4. Neuen SchlĂĽssel `LabConfig` erstellen.
5. Innerhalb von `LabConfig` folgende `DWORD (32-Bit)`-Werte setzen:
   - `BypassTPMCheck = 1`
   - `BypassSecureBoot = 1`
   - `BypassRAMCheck = 1` (optional)


== E~~~ Windows-Installation

1. *Optional:* Boot-Reihenfolge ĂĽberprĂĽfen und sicherstellen, dass das DVD-Laufwerk vor der Festplatte liegt.

2. VM starten, Startzeit der Installation notieren.

3. Windows-Installationsanweisungen folgen:
   - *Lokalisierung:* Deutsch/Ă–sterreich
   - *Edition:* Education (kein ProduktschlĂĽssel erforderlich)
   - *Benutzerdefinierte Installation* auf die gesamte Festplatte
   - *Benutzer:* `junioradmin` (Passwort: `junioradmin`)
   - *Datenschutzeinstellungen* anpassen
4. Installationsdauer und Anzahl der Neustarts notieren.
5. Computer umbenennen: `UE01-Nachname-Vorname`.
6. Einen *Snapshot* der VM erstellen (bei heruntergefahrener VM).
7. *VMware-Tools* installieren und nach Installation einen weiteren *Snapshot* erstellen.


== F~~~  Erkunden und Analyse des PCs

Ermitteln Sie folgende Informationen und dokumentieren Sie, wie Sie diese erhalten haben:

- *Windows-Version* (inkl. Build-Nummer)
- *RAM:* Gesamtgröße und verfügbarer Speicher
- *CPU:* Hersteller, Modell, Taktfrequenz
- *Festplatte:* Datenträger, Größe (GiB und Bytes), belegter und freier Speicher
- *Schnelle Navigation zu Windows-Werkzeugen:*
  - *Task-Manager, Explorer, Systemeigenschaften, Terminal (PowerShell)*
  - *Virtuelle Desktops nutzen* (Taschenrechner in einem, Task-Manager im anderen)

Viel SpaĂź!

now the problems here are following

  1. i want to make the variable filename to able to be overwritten in main.typ
  2. when i import the header into the main file the base text of the main file overlapse with the imported header

id appreaciate any help, thank you

A few comments on your post itself, not about the problem you are having. See How to post in the Questions category for general advice.

  1. The title of your post should be a question that you would ask a friend
  2. Please post questions to the Questions category. This post is in General
  3. Could you reformat the code sections of your post please? It is currently very difficult to read (see the Body section of the How to page)
3 Likes

Hi @Mert_Karavin, thanks for your question! I have moved your post to Questions and formatted your code, as pointed out by gezepi. Please be sure to follow the question guidelines in the future.

However, there are still some issues wit your post you need to address yourself – see the question guidelines:

  • please try to revise your post’s title to be a complete question:

    Good titles are questions you would ask your friend about Typst.

  • the shared code is much longer than it needs to be and not runnable; remove external image file or better yet replace the content with #lorem(...) where it isn’t important.

    It would be great if you could post the smallest possible code samples that allow people to see what your problem is.

    Apart from improving your post, this also respects your teacher’s copyright, as it seems the code is your teacher’s assignment.

Making your question readable is necessary for other users to engage with it and massively increases your chances of receiving an answer.

One final remark: since this seems to be your teacher’s template, I suggest you ask them for help and/or do a bug report if the template doesn’t work correctly. I support my students at the TGM too, for example.

1 Like