Skip to content

Yasu31/latex-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

latex-docker

By using a Docker image, latex documents can be compiled in your local environment (Windows, macOS, or Linux) without needing to install latex locally. This repository does not have to be cloned to use the Docker image.

setup

install Docker

Get the GUI version (https://docs.docker.com/get-docker/) or the CLI version, whichever works for you

usage

run the docker image

  1. Open the terminal and navigate to the directory with the latex source files
    # e.g. on Linux, macOS...
    cd /path/to/your_latex_project
  2. run container
    # on Linux and macOS
    docker run --rm -it -v $(pwd):/workdir yasu31/latex-docker
    # on Windows
    docker run --rm -it -v ${pwd}:/workdir yasu31/latex-docker
    If it tells you "Docker daemon not running", the "Docker Desktop" application will have to be manually started (happens if not set to auto-launch on boot)
  3. once inside the Docker container, compile the latex document
    pdflatex your_main_filename

tip: if your project contains bibtex files, run

pdflatex your_main_filename
bibtex your_main_filename
pdflatex your_main_filename
pdflatex your_main_filename

to make sure the references are correctly resolved.


crop whitespace around pdf

Go to the directory of the PDF in terminal (e.g. in Windows, right click within folder and "Open in Terminal")

pdfcrop my_pdf_file.pdf
# to overwrite input PDF
pdfcrop my_pdf_file.pdf my_pdf_file.pdf

use latexdiff to compare two versions of a document

  1. structure the latex source files as follows:
    your_project
    |- old/
    |   `- [source files for the old version]
    |- new/
    |   `- [source files for the new version]
    `- diff/
        `- [leave it empty]
    
  2. go to this directory in the terminal and run Docker
  3. generate the diff files
    python3 generate_diff.py
  4. navigate to the diff/ directory and compile the generated latex document as you would a normal latex document

About

compile latex documents on your PC without the hassle of installing latex

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published