A Light-weight TeX Live Docker Image for LaTeX
294
A Light-weight TeX Live Docker Image for LaTeX
texlive-small is a TeX Live Docker image with scheme-small installation and some common packages.
It allows you to write LaTeX and generate high quality pdf files.
Also, it focuses on English and traditional Chinese, so its size is much less than the TeX Live with scheme-full installation.
docker by following Docker official installation guide.
Docker is cross-platform so you can run texlive-small on Mac OSX / Linux / Windows.docker pull weichuntsai/texlive-small:1.1.0
docker run --name ${The Container Name You Want} -dt -v ${Your Directory for Tex files}:/home weichuntsai/texlive-small:1.1.0
For example,
docker run --name mylatex -dt -v /Users/jimmy_tsai/Documents:/home weichuntsai/texlive-small:1.1.0
mylatex), rundocker exec -it mylatex bash
For what commands you can use in this container, please refer to the following Usage parts.
To see README in the container, just run:
$ more /README-texlive-small.md
pdf from a texThe command is as below:
$ txrun ${tex_file} ${engine_type}
where tex_file is your tex, and engine_type is the LaTeX engine and it could be one of xelatex, latex, or pdflatex.
Now we are going to explain which engine_type you should use.
Let's assume your tex is my_input.tex, then:
tex contains the command \usepackage{fontspec} (because you want to use \setmainfont{another font} to change the font), then you have to run:$ txrun my_input.tex xelatex
tex contains non-English content (for example, traditional Chinese), then you have to run:$ txrun my_input.tex xelatex
tex (without \usepackage{fontspec}) contains English content and eps figures, then you can run:$ txrun my_input.tex xelatex
or
$ txrun my_input.tex latex
tex (without \usepackage{fontspec}) contains English content and does not contain eps figures, then you can run:$ txrun my_input.tex xelatex
or
$ txrun my_input.tex latex
or
$ txrun my_input.tex pdflatex
Note that txrun is just a convenient wrapper of (xe/pdf)latex and would remove some derived files you don't need:
txrun my_input.tex xelatex does isrm my_input.aux my_input.bbl my_input.blg my_input.idx my_input.ilg my_input.ind my_input.lof my_input.log my_input.lot my_input.out my_input.toc my_input.dvi
xelatex my_input.tex
bibtex my_input.aux
xelatex my_input.tex
xelatex my_input.tex
rm my_input.aux my_input.bbl my_input.blg my_input.idx my_input.ilg my_input.ind my_input.lof my_input.log my_input.lot my_input.out my_input.toc my_input.dvi
txrun my_input.tex latex does isrm my_input.aux my_input.bbl my_input.blg my_input.idx my_input.ilg my_input.ind my_input.lof my_input.log my_input.lot my_input.out my_input.toc my_input.dvi
latex my_input.tex
bibtex my_input.aux
latex my_input.tex
latex my_input.tex
dvipdf my_input.dvi
rm my_input.aux my_input.bbl my_input.blg my_input.idx my_input.ilg my_input.ind my_input.lof my_input.log my_input.lot my_input.out my_input.toc my_input.dvi
txrun my_input.tex pdflatex does isrm my_input.aux my_input.bbl my_input.blg my_input.idx my_input.ilg my_input.ind my_input.lof my_input.log my_input.lot my_input.out my_input.toc my_input.dvi
pdflatex my_input.tex
bibtex my_input.aux
pdflatex my_input.tex
pdflatex my_input.tex
rm my_input.aux my_input.bbl my_input.blg my_input.idx my_input.ilg my_input.ind my_input.lof my_input.log my_input.lot my_input.out my_input.toc my_input.dvi
There are 2 ways to install fonts you like:
apt-get install ${font_package_name} to install the fonts in Ubuntu library.addfont. For example, you can visit https://fonts.google.com/specimen/Roboto and click "Download family" button to download "Roboto" font. The downloaded file is a zip file. Unzip it and you would get an unzipped folder called "Roboto". Then in the texlive-small container, go to the directory containing "Roboto" folder and then run addfont ./Roboto.texlive-small containerJust run fc-list
texJust run fc-list : family
texlive-small image (you don't need to install again)Roboto -> sans-serif for EnglishNoto Serif TC -> serif for traditional ChineseNoto Sans TC -> sans-serif for traditional ChineseLatex has its default English font. If you wan to change it (ex: you want to change it into Roboto), please do the following:
In your tex, before the line \begin{document}, add lines as below
% In your tex file
\usepackage{fontspec}
\setmainfont{Roboto} % Fill in any English font name you installed.
\begin{document}
...
\end{document}
There are 2 scenarios
Noto Serif TC)In your tex, before the line \begin{document}, add lines as below
% In your tex file
\usepackage{xeCJK}
\setCJKmainfont{Noto Serif TC} % Fill in any CJK font name you installed.
\begin{document}
...
\end{document}
AR PL UMing TW)In your tex, before the line \begin{document}, add lines as below
% In your tex file
\usepackage[BoldFont, SlantFont]{xeCJK}
\setCJKmainfont{AR PL UMing TW} % Fill in any CJK font name you installed.
\begin{document}
...
\end{document}
$ tlmgr search --global ${package_name}
For examle, to search the package named marginnote:
$ tlmgr search --global marginnote
$ tlmgr search --global --file ${file_name}
For example, to search the package which contains the file marginnote.sty:
$ tlmgr search --global --file marginnote.sty
$ tlmgr install ${package_name}
For example, to install the package marginnote:
$ tlmgr install marginnote
$ tlmgr remove ${package_name}
For example, to remove the package named marginnote:
$ tlmgr remove marginnote
$ tlmgr option repository ${repo_link}
For example:
$ tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet
When you search / install packages and find that tlmgr is pending for a long time (server error or no reponse),
in this case, you could consider to change the package repository.
$ fc-list
tlmgr install) - method 1In fact you can just download the tds.zip of the package you want from CTAN then install it manually.
For example, if you want to install marginnote:
marginnote then enter into the marginnote page of CTANmarginnote.tds.zipmarginnote.tds.zip into the Docker container. For example:
we copy it from /Users/jimmy_tsai/Downloads into /root of the container:docker cp /Users/jimmy_tsai/Downloads/marginnote.tds.zip ${container_id}:/root
/root and unzip marginnote.tds.zip to $TEXMFHOME. For example:$ cd /root
$ unzip marginnote.tds.zip -d $TEXMFHOME
Basiclly no need to update tlmgr index.
tlmgr install) - method 2In fact you can just download the tds.zip of the package you want from CTAN then install it manually.
For example, if you want to install marginnote:
marginnote then enter into the marginnote page of CTANmarginnote.tds.zipmarginnote.tds.zip into the Docker container. For example:
we copy it from /Users/jimmy_tsai/Downloads into /root of the container:docker cp /Users/jimmy_tsai/Downloads/marginnote.tds.zip ${container_id}:/root
/root and unzip marginnote.tds.zip to /usr/local/texlive/texmf-local/. For example:$ cd /root
$ unzip marginnote.tds.zip -d /usr/local/texlive/texmf-local/
tlmgr index$ mktexlsr /usr/local/texlive/texmf-local
The key point is that you have to use the cls (assume it is some_journal.cls)
of the journal in your tex by the line \documentclass{some_journal}.
Journals usually provide a template package (usually it is a zip)
containing a cls (which defines the journal style) and some template tex files.
For different journals, there are usually 2 scenarios for the template package:
cls and a template tex.
Usually the template tex already used the cls in \documentclass and
what you have to do is to modify the text content of the template tex.tds.zip and a template tex.
First, you have to unzip tds.zip to TeX Live directory, and then
you can modify the text content of the template tex.Here we use IEEE for Scenario 1 and Physical Review Journals for Scenario 2 as demonstration examples.
zip) from the page you found in Step 1.cls (assume it is IEEEtran.cls) and a template tex.tex, it usually already used IEEEtran.cls by the line \documentclass[conference]{IEEEtran},
so what you have to do is to modify the text content of the template tex.tex (assume it is conference_041818.tex), runtxrun conference_041818.tex latex
zip) from the page you found in Step 1.tds.zip (assume it is revtex4-1-tds.zip) and a README.README to unzip the revtex4-1-tds.zip to TeX Live directory and update TeX Live package index.
Usually the commands are like this$ unzip revtex4-1-tds.zip -d /usr/local/texlive/texmf-local/
$ mktexlsr /usr/local/texlive/texmf-local
tex in the unzipped tds.zip and modify the text content in it.
For exmaple, it is usually in /usr/local/texlive/texmf-local/doc/latex/revtex/sample/aps and
/usr/local/texlive/texmf-local/doc/latex/revtex/sample/aip.tex (assume it is apssamp.tex), runtxrun apssamp.tex latex
Finally I list 2 reminds here:
xelatex or pdflatex for the 2nd argument (LaTeX engine) of txrun and see if the result is OK.
For different journals, different LaTeX engines could cause a little different visual effetcs.eps figures in your tex, please do NOT use pdflatex for the LaTeX engine.Content type
Image
Digest
Size
552.9 MB
Last updated
over 5 years ago
docker pull weichuntsai/texlive-small:1.1.0