Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LaTeX Document

This is a minimal Markdown quick start. Write your content as plain Markdown in manuscript.md; the thin wrapper main.tex pulls it in with \markdownInput and LaTeX turns it into a PDF — no thesis scaffolding, just the essentials: headings, citations, footnotes, tables, figures, smart cross-references (\zcref), and acronyms (defined once in the wrapper, recognized automatically in the running text and collected in an acronym list). Keeping the prose in a real .md file means your editor treats it as Markdown and the spell-/prose-checkers below lint it directly.

The LaTeX snippets this template is assembled from can be inspected at https://latextemplates.github.io/latex-snippets/.

Usage

  • main.tex is the main document
  • Use "lualatex + biblatex" in your TeX editor or latexmk main / make in the command line

Using latexmk

latexmk is a very smart tool for latex compilation. It executes the latex tools as often as needed to get the final PDF. (More information about why latexmk is great can be found at https://tex.stackexchange.com/a/249243/9075.)

To build the whole document, execute following command. Note that this requires a working perl installation.

latexmk main

To enable latexmk, please move _latexmkrc to latexmkrc.

If you want automatic compilation use following command:

latexmk -pvc main

This will also open a Sumatra PDF and only works with the supplied configuration.

latexmk configuration

This repository ships a .latexmkrc which is read by latexmk. In case there is a _latexmkrc file, you need to rename it to .latexmkrc. It is configured for Windows and especially sets Sumatra PDF as default PDF viewer. You can make this local configuration a global configuration, when you put it at the right place.

If you want to add more packages, configure it there. For instance, for support of makeglossaries see http://tex.stackexchange.com/questions/1226/how-to-make-latexmk-use-makeglossaries.

Debugging LaTeX errors

In case something goes wrong, you can instruct the LaTeX compiler to stop at the first error:

lualatex --synctex=1 --shell-escape main

Run biber main to get the bibliography rendered (execute lualatex afterwards).

Advanced usage

On the command line, there are additional features:

  • latexmk -C or make clean for cleaning up
  • make format to reformat the .tex files (one sentence per line and indent)
  • make aspell for interactive spell checking
  • make stand: Creates a new PDF with the current status of the document.
  • make view: Opens the configured viewer
  • make mrproper: Cleans up and removes also editor backup files.

Linting your Markdown

Because the prose is a plain Markdown file, the text linters run on it directly — no extraction, and the reported line numbers point straight at manuscript.md. Two workflows lint it and post inline annotations: check-markdown runs Vale (spelling, repetition), and check-textlint runs textlint (write-good + terminology).

Run textlint locally with npx (needs Node.js; rules come from .textlintrc.json):

npx --yes --package textlint --package textlint-rule-terminology --package textlint-rule-write-good textlint manuscript.md

For Vale, install it (brew install vale / choco install vale, or see https://vale.sh/docs) and point it at the file:

vale manuscript.md

Tool hints

Prerequisites

Usage of minted

To have minted running properly, you have to do following steps on Windows:

  1. Install python: choco install python - that uses chocolatey to install Python
  2. Install latexminted: pip instal latexminted - that uses the Python package manager to install the minted library
  3. When latexing, use -shell-escape: pdflatex -shell-escape main. You can also just execute latexmk main.

VS Code configuration

Currently, following extensions are recommended:

Then, change the setting of LaTeX Workshop to use biber:

Press Shift+Ctrl+P to open the command palette. Then type "JSON" and select "Preferences: Open Settings (JSON)" to open settings.json.

Update the following lines in VS Code's settings.json to contain:

    "latex-workshop.latex.recipes": [
        {
            "name": "lualatex ➞ biblatex ➞ lualatex × 2 🔃",
            "tools": [
                "lualatex",
                "biblatex",
                "lualatex",
                "lualatex"
            ]
        },
    ],
    "latex-workshop.latex.tools": [
        // ...
        {
            "name": "biblatex",
            "command": "biblatex",
            "args": [
                "%DOCFILE%"
            ],
            "env": {}
        },
        // ...
    ],

The following settings are additionally recommended:

{
    "editor.wordWrap": "on",                              // enable soft line breaks
    "latex-workshop.view.pdf.viewer": "tab",              // display the generaded PDF in a separate tab
    "latex-workshop.view.pdf.backgroundColor": "#cccccc", // use a darker background in de PDF viewer to lift of the pages from it
    "latex-workshop.latex.autoBuild.run": "never",        // never automatically build; alternative: "onSave" (on saving .tex files)
    "editor.renderWhitespace": "all",                     // display all whitespaces
}

Alternatively, just copy and paste the contents of the vscode.settings.json file to your VS Code settings file.

You can manually trigger compilation by hitting the green button in the extension or using other methods provided by LaTeX Workshop.

Please remove the magic comments (% !TeX program ...) at the top of the main.tex file. Although LaTeX-Workshop supports magic comments, it currently does not work reliably. Without the magic comments, compilation works.

LTeX+ tips and tricks

LTeX+ is an offline grammar and spell checker with support for LaTeX and Markdown.

Add a magic comment to your files to tell LTeX+ which language to use:

% LTeX: language=de-DE

If you want to use different languages in the text, use the \foreignlanguage{language}{text} command. LTeX+ will detect these elements and automatically switch the spell checker's language. For example:

\foreignlanguage{english}{Therefore, our proposed approach will change the world.}

Usage with docker

The generated Dockerfile is based on the Dockerfile by the Island of TeX.

docker run --rm -v "c:\users\example\latex-document:/workdir" ltg latexmk

Following one-time setup is required:

docker build -t ltg .

Further information

License

The license of this work is 0BSD which corresponds to "public domain". Any derived work can freely be relicensed and can omit original copyright and license information.

About

Minimal Markdown quick-start LaTeX template — write in Markdown, compile with LuaLaTeX + biber. Generated from generator-latex-template (--documentclass=mwe).

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages