Skip to content

Instantly share code, notes, and snippets.

@yasinuygun
Last active January 8, 2024 09:00
Show Gist options
  • Save yasinuygun/486349e0058160f2abc3350a4b244b9e to your computer and use it in GitHub Desktop.
Save yasinuygun/486349e0058160f2abc3350a4b244b9e to your computer and use it in GitHub Desktop.

LaTeX on MacOS

  1. Install texlive.

    curl -LO http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
    tar -xzf install-tl-unx.tar.gz
    rm install-tl-unx.tar.gz
    cd install-tl-*
    chmod +x install-tl
    ./install-tl

    If the tar.gz file's link has changed, please find the updated link from here, or Google.

  2. Install TeXstudio (Optional): It is just a text editor for LaTeX.

  3. Install inkscape (Optional): Required for the svg package.

    brew install inkscape
  4. Compile: To generate an auxiliary file and add citations, use the following commands:

    pdflatex --shell-escape -synctex=1 -interaction=nonstopmode main.tex 
    bibtex main
    pdflatex --shell-escape -synctex=1 -interaction=nonstopmode main.tex
    pdflatex --shell-escape -synctex=1 -interaction=nonstopmode main.tex

    Running pdflatex at-least twice at the end is necessary for proper citation insertions into pdf.

    Unified Function (Optional): Insert into your shell rc (e.g. .bashrc) file:

    compiletex() {
      pdflatex --shell-escape -synctex=1 -interaction=nonstopmode $1.tex
      bibtex $1
      pdflatex --shell-escape -synctex=1 -interaction=nonstopmode $1.tex
      pdflatex --shell-escape -synctex=1 -interaction=nonstopmode $1.tex
    }

    Usage:

    compiletex main
  5. Install packages: To install LaTeX packages, use the following commands:

    sudo tlmgr install [package]
    sudo tlmgr install svg # example

    If tlmgr doesn't work, reinstalling texlive from step one might resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment