Skip to content

andrader/usp-thesis-typst-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USP Thesis Typst Template

A comprehensive, extensible Typst template for theses and dissertations at the University of São Paulo (USP) and specifically the Institute of Mathematics and Statistics (IMEUSP), following the official guidelines (5th edition, 2024).

Example output PDF generated with this template: usp-example.pdf

Features

  • Official Layout: Correct margins (3cm/2cm), A4 size, and 1.5 line spacing.
  • Automated Elements: Generates Cover, Title Page, Approval Sheet, and Abstracts.
  • IMEUSP Support: Specific branding and "Standard Statement" for the Institute of Mathematics and Statistics.
  • Extensible: Easily adaptable to other USP institutes.
  • Pre-textual Elements: Support for Dedication, Acknowledgments, and Epigraph.

Table of Contents

Prerequisites

  • Typst Compiler: Typst is a modern, faster, and more intuitive typesetting alternative to LaTeX, featuring cleaner syntax and instant compilation, making it ideal for new projects.

    [Click to expand] How to install Typst ⚙️

    MacOS

    Open Terminal and run:

    brew install typst

    Linux

    Open Terminal and run:

    # For Debian/Ubuntu-based distributions
    sudo apt install typst
    # For Fedora-based distributions
    sudo dnf install typst
    # Snap
    sudo snap install typst

    Windows

    Open PowerShell and run:

    winget install typst

Install the Template Package

MacOS

# Clone the repository at the correct location for local Typst packages
git clone https://github.com/andrader/usp-thesis-typst-template ~/Library/Application\ Support/typst/packages/local/usp-thesis/0.1.0/

Linux

# Clone the repository at the correct location for local Typst packages
git clone https://github.com/andrader/usp-thesis-typst-template ~/.local/share/typst/packages/local/usp-thesis/0.1.0/

Windows

# Clone the repository at the correct location for local Typst packages
git clone https://github.com/andrader/usp-thesis-typst-template $env:APPDATA\typst\packages\local\usp-thesis\0.1.0

Initialize a new project

In your Typst project, on your terminal initialize the template with:

typst init @local/usp-thesis:0.1.0

Then, you can generate the PDF with:

cd usp-thesis
typst compile main.typ

To watch for changes and recompile automatically:

typst watch main.typ

Example Usage

#import "@local/usp-thesis:0.1.0": usp-thesis

#show: usp-thesis.with(
  title: [Your Thesis Title],
  author: "Your Name",
  advisor: "Advisor's Name",
  institute: "Instituto de Matemática e Estatística",
  program: "Probability and Statistics",
  degree: "Mestre", // or "Doutor"
  abstract-pt: [ ... ],
  keywords-pt: ("Keyword1", "Keyword2"),
  abstract-en: [ ... ],
  keywords-en: ("Keyword1", "Keyword2"),
  banca: (
    (nome: "Examiner 1", instituicao: "USP"),
    (nome: "Examiner 2", instituicao: "Unicamp"),
  ),
)

= Introduction
Your content starts here...

Configuration Options

The usp-thesis function accepts the following parameters:

Parameter Type Description
title content The main title of the work.
subtitle content Optional subtitle.
author string Full name of the author.
advisor string Full name of the supervisor.
institute string Full name of the USP institute.
degree string "Mestre" or "Doutor".
program string Name of the graduate program.
version string "Original" or "Corrigida" (Default: "Original").
banca array List of dictionaries (nome: "", instituicao: "") for the jury.
list-of-figures bool / auto Whether to include the list of figures (auto: show if >= 5).
list-of-tables bool / auto Whether to include the list of tables (auto: show if >= 5).
abstract-pt content Abstract in Portuguese.
abstract-en content Abstract in English.

Future Extensions

To add support for a new institute with a specific "Nature Text", modify the logic in src/lib.typ:

let nature-text = if institute.contains("Your Institute") {
  "Specific Statement for your Institute"
} else {
  // default ABNT/USP statement
}

Development and Testing

To install this Typst package locally for development or testing, create symlinks as follows (macOS example):

# Create the necessary directories if they don't exist
mkdir -p ~/Library/Application\ Support/typst/packages/local/usp-thesis/
# Create a symbolic link to the current directory
ln -sfn $PWD ~/Library/Application\ Support/typst/packages/local/usp-thesis/0.1.0
# Verify the files are correctly linked
ls -l ~/Library/Application\ Support/typst/packages/local/usp-thesis/0.1.0

Then, in your Typst files, import the package with:

#import "@local/usp-thesis:0.1.0": *

You can store packages in {data-dir}/typst/packages/{namespace}/{name}/{version} to make them available locally on your system. Here, {data-dir} is

  • $XDG_DATA_HOME or ~/.local/share on Linux
  • ~/Library/Application Support on macOS
  • %APPDATA% on Windows

You may also run typst info and check Package path for the actual path. This would be helpful if you have installed the Typst compiler from Snap or are using special environment variables.

License

MIT

About

A comprehensive, extensible Typst template for theses and dissertations at the University of São Paulo (USP), following the official guidelines (5th edition, 2024).

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors