Skip to content

Instantly share code, notes, and snippets.

@zommiommy
Last active April 5, 2021 16:42
Show Gist options
  • Save zommiommy/65d9f327d4ccfd5a5166b9e221bbd336 to your computer and use it in GitHub Desktop.
Save zommiommy/65d9f327d4ccfd5a5166b9e221bbd336 to your computer and use it in GitHub Desktop.
Firing up LaTex on Windows 🔥

Firing up LaTex on Windows 🔥

Tex

There are 2 main Tex Distribution for windows The main difference is that TexLive has tlmgr that allows you to make a granular installation downloading only the package that you'll need. While MikTex has tons of packagee per installed but it works too.

TexLive

TexLive for windows Click here to download it (Warning: The full installation of TexLive is big and it will take a while)

MikTex

MikTex Click here to download the full version

Programs you'll need

Gnuplot

GnuPlot is a small library for drawing some kind of plots, I use it all the time. You can download it here

Imagemagick

Imagemagick You can download it here

SumatraPdf

SumatraPdf is a pdf viewer that syncs nicely with sublime text. You can download it here

Cpan & LatexIndent

Latexindent There is a problem, currently cpan Log::Log4perl fail the headers test so we have to fore-install it skipping the tests. Here a reddit thread about it..

To install Cpan and use LatexIndent you'll need Perl

Perl

strawberryperl You can download it here

Just execute the command cpan in the terminal and follow its instruction. Then exit from the cpan ambient and install the following dependencies as follow:

cpan XML::DOM
cpan Log::Dispatch
cpanm -n Log::Log4perl
cpan YAML::Tiny
cpan Getopt::Long
cpan File::HomeDir
cpan Unicode::GCString

Now exit from cpan and try running the command latexindent. Make sure that it runs.

Setup with sublime text

After following my guide over here we can continue here. Add to your package control settings these packages:

{
  "installed_packages":
  [
   "LaTeX-cwl",
   "LaTeXSmartQuotes",
   "LaTeXTools",
   "LaTeXYZ"
  ]
}

Shell escape

With packages such as minted you will need to enable shell escape. Just open up the package specific settings for LaTeXTools and add in the builder settings the following options:

"builder_settings" : {
    "display_log" : false,
    "options": [
        "--shell-escape"
    ],
    "osx" : {},
    "windows" : {},
    "linux" : {}
},

Get pygments

Pygments script is necessary for stuff like code highlight. You might have already this installed.

Python

To ger Pygments you have to have some python distribution installed, if you haven't one you can download the latest python 3 release here

then you can install pygmentize with this command

pip install pygmentize

If you have already installed it with Anaconda and your Tex editor does not find it, probably you need to make Anaconda your default python adding it to your PATH enviorment variable: video tutorial

Adding usefull repositories

Adding BeautifyLatex

BeautifyLatex is a a package for sublime text that help format the latex code using latexindent. You need to add this by hitting ctrl+maiusc+p and search for "Add Repository". Then you can add the package as usual, with ctrl+maiusc+p and "Add Package".

Adding Dictionaries

Dictionaries adds multilanguage dictionaries for your latex projects. You need to add this by hitting ctrl+maiusc+p and search for "Add Repository". Then you can add the package as usual, with ctrl+maiusc+p and "Add Package".

Packages commonly needed

What follows is a list of packages that are commonly needed (they are needed in our main project), they come installed with the complete package from MikTex, but I prefer a granular approach to avoid useless software. They can be installed all with the following command:

tlmgr install latexmk subfiles ctablestack luacode luatex85 silence emptypage framed biblatex logreq xstring chngcntr sectsty minted fvextra ifplatform ifoddpage relsize relsize csquotes pgfplots circuitikz paralist enumitem glossaries datatool glossaries-english glossaries-italian glossaries-german mfirstuc xfor substr imakeidx fourier utopia quotchap soul collection-fontsrecommended algorithm2e xargs stanli preview standalone tikz-qtree

Here you can read to have an idea on the usage of each package:

Description of every package

Latexmk

Latexmk is a tool used to build latex documents.

Subfiles

Subfiles is a package that allows to compile subfiles.

Ctablestack

Ctablestack is a package that allows to render tables.

Luacode

Luacode is a package that allows to compile luacode in luatex.

Silence

Silence is a package that allows to shush noise and useless warnings.

Emptypage

Emptypage is a package that allows to leave empty pages to separate topics.

Frames

Frames is a package that allows to frame theorems, definitions etc..

Bitlatex

Biblatex is a package that allows to load bibliographies.

Logreq

Logreq is a package that allows to automate some workflows.

Xstring

Xstring is a package that allows to automate workflows on string editing.

Chngcntr

Chngcntr is a package that allows to reset counters for images, equations etc...

Sectsty

Sectsty is a package that allows you to apply custom styles to chapters and sections.

Minted

Minted is a package that allows you to highlight code.

fvextra

Fvextra is a package that automates line breaks.

Ifplatform

Ifplatform is a package that allows for if statements in latex for the various compilers (pdflatex, latex, lualatex...).

Ifoddpage

ifoddpage is a package that allows to check if the current page is odd or even.

Relsize

Relsize sets relative font size.

Csquotes

Csquotes allows for automatic smart quotes.

Pgfplots

Pgfplots allows compiling cool graphs.

Circuitikz

Circuitikz allows to draw circuits.

Paralist

Paralist allows for advanced lists.

Glossaries

Glossaries allows to automate glossaries.

Mfirstuc

Mfirstuc allows to make first letter upper case.

Xfor

Mfirstuc reimplements stronger latex "for" cycles implementation.

Substr

Substr enables commands to check substring relationships.

Tracklang

Substr enables you to get info about the current language from babel or polyglossia.

Imakeidx

Imakeidx builds automatically the index.

Fourier

Fourier extends the fonts enabled in amsmath.

Quotchap

Quotchap enables nice style for chapters.

Quotchap

Quotchap enables nice style for chapters.

Soul

Soul enables Hyphenation for letterspacing, underlining, and more.

Fontsrecommended

Fontsrecommended is a collection of fonts commonly used.

Algorithm2e

(https://ctan.org/pkg/algorithm2e?lang=en)[algorithm2e] Algorithm2e is a package to write pseudocode.

Xargs

(https://ctan.org/pkg/xargs?lang=en)[Xargs] is a package that provides extended versions of \newcommand

Stanli

(https://ctan.org/pkg/stanli?lang=en)[Stanli] is a package to draw 2d and 3d structural analysis.

Preview and Standalone

(https://ctan.org/pkg/preview?lang=en)[Preview] and (https://ctan.org/pkg/preview?lang=en)[Standalone] are packages used to run math preview in latextools in sublime text.

Tikz-qtree

(https://ctan.org/pkg/tikz-qtree?lang=enn)[Tikz-qtree] is a package to easily draw trees.

@cmhughes
Copy link

cmhughes commented Apr 5, 2021

For latexindent.pl, there's no need for Log4Perl as of Version 3.9 :)

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