CommunityData:TeX: Difference between revisions

From CommunityData
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Installing Dependencies ==
In order to write LaTeX documents, there are two main options. The first is to do everything in Overleaf. The second option, which is explained below in this document under [[#Installing TeX on your computer]], is to install software on your local machine which will compile LaTeX documents.
 
This document explains how to use our lab-created templates. Using other templates may require other steps.
 
== Getting/Installing Templates ==
 
You can find the latest version of the templates [https://code.communitydata.science/cdsc_tex.git here].
 
To clone the public repository, you can do:
 
git clone git://code.communitydata.science/cdsc_tex
 
If you can clone them into the directory <code>~/tex/</code> (e.g., by doing <code>mkdir ~/tex; cd ~/tex</code> before running the clone command above) it will make things a bit easier.
 
This code includes a bunch of bash scripts which are used to quickly create a new project. If you want, you can copy the files into your path (e.g., <code>ln -s ~/tex/cdsc_tex/new* ~/bin/</code>); this will allow you to run, for example, <code>new_knitr_document documentname</code> to create a new knitr document from the template.
 
== Using the paper templates ==
 
There are quite a number of useful instructions sprinkled throughout the TeX source file in comments. You should pay particular attention to the comments that begin with:
 
% LATEX NOTE:
 
There are two styles that come with the package with two basic layouts that are defined. To switch between them, you just edit the following line:
 
\chapterstyle{cdsc-article}
 
The first style <code>cdsc-article</code> is great for papers ([https://mako.cc/academic/shaw_hill-laboratories_of_oligarchy-DRAFT.pdf a perhaps dated example]).
 
The second style <code>cdsc-memo</code> is more for shorter pieces and memos ([https://mako.cc/academic/bmh-research_statement.pdf a perhaps dated example]).
 
If you want to use the style, you might want to consider switching the <code>\chapterstyle</code> line mentioned above <code>cdsc-article</code> to <code>cdsc-memo</code> by editing the following line.
 
If you want to include git commit IDs and datestamp on each page of the paper, you can uncomment the following lines which will import version control information after running <copde>make vc</code>
 
\input{vc}
\pagestyle{cdsc-page-git}
 
One problem is that that this can be tricky to get to work on Overleaf. This alternative line will just input a timestamp at the build process:
 
\pagestyle{cdsc-page-overleaf}
 
Either approach can be useful for keeping track of which version of a document somebody has.
 
The templates themselves use the [http://texdoc.net/texmf-dist/doc/latex/memoir/memman.pdf LaTeX Memoir Class] (warning that link is a ~1000 page PDF and the documentation).
 
== Using the Beamer templates ==
 
The beamer templates are described in [[CommunityData:Beamer]].
 
== Using the poster template ==
 
The poster template is in a subdirectory called <code>poster_template</code> within the <code>cdsc_tex</code> repository above. The template is actually just a single Beamer slide. You can simply upload all the files in this directory to Overleaf and/or build them following instructions over on [[CommunityData:Beamer]].
 
== Sending Patches to the templates ==
 
If you want to send patches, these currently should be sent over email to mako. Details on how to do this with the <code>git format-patch</code> command are online here: https://code.communitydata.science/
 
== Installing TeX on your computer ==
=== Debian/Ubuntu Installation Instructions ===
=== Debian/Ubuntu Installation Instructions ===


Line 31: Line 88:
  texlua install-getnonfreefonts
  texlua install-getnonfreefonts
  sudo getnonfreefonts-sys garamond
  sudo getnonfreefonts-sys garamond
== Installing Template ==
You can find the latest version of Mako's templates here: http://projects.mako.cc/source/?p=latex_mako
To clone the public repository, you can do:
git clone git://projects.mako.cc/latex_mako
If you can clone them into the directory <code>~/tex/</code> (e.g., by doing <code>mkdir ~/tex; cd ~/tex</code> before running the clone command above) it will make things a bit easier.
If you want, you can copy the files new_tex_document  new_tex_letter into your path (e.g., <code>~/bin</code>) this will allow you to run <code>new_tex_document documentname</code> to create new documents from the template more easily. It's totally optional.
== Using the Templates ==
The templates themselves use the [http://texdoc.net/texmf-dist/doc/latex/memoir/memman.pdf LaTeX Memoir Class] (warning that link is a ~1000 page PDF and the documentation). There are three styles that come with it and two basic layouts that are defined. To switch between them, you just edit the following line:
\chapterstyle{article-2}
The first style <code>article-1</code> is the most conservative. <code>article-2</code> is great for papers ([https://mako.cc/academic/shaw_hill-laboratories_of_oligarchy-DRAFT.pdf a perhaps dated example]). The third style <code>article-3</code> is more for shorter pieces and memos ([https://mako.cc/academic/bmh-research_statement.pdf a perhaps dated example]). If you want to use the style, you might want to consider switching the pagestyle from <code>mako-mem</code> to <code>memo</code> by editing the following line:
\pagestyle{mako-mem}
== Sending Patches ==
If you want to send patches, these currently should be sent over email to mako. Details on how to do this with the <code>git format-patch<code> command are online here: http://projects.mako.cc/source/

Latest revision as of 22:16, 10 October 2022

In order to write LaTeX documents, there are two main options. The first is to do everything in Overleaf. The second option, which is explained below in this document under #Installing TeX on your computer, is to install software on your local machine which will compile LaTeX documents.

This document explains how to use our lab-created templates. Using other templates may require other steps.

Getting/Installing Templates[edit]

You can find the latest version of the templates here.

To clone the public repository, you can do:

git clone git://code.communitydata.science/cdsc_tex

If you can clone them into the directory ~/tex/ (e.g., by doing mkdir ~/tex; cd ~/tex before running the clone command above) it will make things a bit easier.

This code includes a bunch of bash scripts which are used to quickly create a new project. If you want, you can copy the files into your path (e.g., ln -s ~/tex/cdsc_tex/new* ~/bin/); this will allow you to run, for example, new_knitr_document documentname to create a new knitr document from the template.

Using the paper templates[edit]

There are quite a number of useful instructions sprinkled throughout the TeX source file in comments. You should pay particular attention to the comments that begin with:

% LATEX NOTE:

There are two styles that come with the package with two basic layouts that are defined. To switch between them, you just edit the following line:

\chapterstyle{cdsc-article}

The first style cdsc-article is great for papers (a perhaps dated example).

The second style cdsc-memo is more for shorter pieces and memos (a perhaps dated example).

If you want to use the style, you might want to consider switching the \chapterstyle line mentioned above cdsc-article to cdsc-memo by editing the following line.

If you want to include git commit IDs and datestamp on each page of the paper, you can uncomment the following lines which will import version control information after running <copde>make vc

\input{vc}
\pagestyle{cdsc-page-git}

One problem is that that this can be tricky to get to work on Overleaf. This alternative line will just input a timestamp at the build process:

\pagestyle{cdsc-page-overleaf}

Either approach can be useful for keeping track of which version of a document somebody has.

The templates themselves use the LaTeX Memoir Class (warning that link is a ~1000 page PDF and the documentation).

Using the Beamer templates[edit]

The beamer templates are described in CommunityData:Beamer.

Using the poster template[edit]

The poster template is in a subdirectory called poster_template within the cdsc_tex repository above. The template is actually just a single Beamer slide. You can simply upload all the files in this directory to Overleaf and/or build them following instructions over on CommunityData:Beamer.

Sending Patches to the templates[edit]

If you want to send patches, these currently should be sent over email to mako. Details on how to do this with the git format-patch command are online here: https://code.communitydata.science/

Installing TeX on your computer[edit]

Debian/Ubuntu Installation Instructions[edit]

First, you'll want to install the following packages:

  • rubber
  • latexmk
  • texlive-latex-recommended
  • texlive-latex-extra
  • texlive-fonts-extra
  • texlive-fonts-recommended
  • texlive-bibtex-extra
  • moreutils
  • gawk

Also, to install Garamond grab and install the font from here through the following complicated process:

  • Download the file
  • Create ~/texmf if it does not exist yet
  • Unzip the file ugm.zip from the garamond.zip file into that ~/texmf/
  • Copy the other font files in the root directory of garamond.zip into ~/texmf/fonts/type1/
  • Run "texhash ~/texmf

Alternatively, if you want to install them system wide and have root credentials, you can also place them in /usr/local/share/texmf instead.

Using MacTeX on OSX[edit]

To install with MacTeX, you need to install the font:

wget http://tug.org/fonts/getnonfreefonts/install-getnonfreefonts
texlua install-getnonfreefonts
sudo getnonfreefonts-sys garamond