Consolidate document creation scripts and fix bugs
Replace the individual new_knitr_document, new_tex_assignment, and new_tex_letter scripts with a single new_tex_document script that takes a document type as its first argument. Fix bugs present in all scripts: unquoted variables, TMPDIR name collision, missing existence checks, and mktemp running unconditionally. Add cdsc_tex_aliases.sh for backwards compatibility with old script names. Add rename_tex_to_dirname script (moved from ~/bin). Update README and wiki page to reflect new setup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
108
wiki_page.wiki
Normal file
108
wiki_page.wiki
Normal file
@@ -0,0 +1,108 @@
|
||||
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://gitea.communitydata.science/collective/cdsc_tex here].
|
||||
|
||||
To clone the public repository, you can do:
|
||||
|
||||
git clone https://gitea.communitydata.science/collective/cdsc_tex.git
|
||||
|
||||
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 repository includes scripts for quickly creating a new project from a template. Symlink them into your PATH with:
|
||||
|
||||
ln -s ~/tex/cdsc_tex/new_tex_document ~/bin/
|
||||
ln -s ~/tex/cdsc_tex/rename_tex_to_dirname ~/bin/
|
||||
|
||||
The main script is <code>new_tex_document</code>, which takes a document type and destination directory:
|
||||
|
||||
new_tex_document <type> <directory>
|
||||
|
||||
Available types are <code>paper</code>, <code>assignment</code>, <code>knitr</code>, and <code>letter</code>. For example:
|
||||
|
||||
new_tex_document paper my-new-paper
|
||||
new_tex_document knitr my-knitr-paper
|
||||
|
||||
The repository also includes <code>cdsc_tex_aliases.sh</code>, which defines aliases for the old individual script names (<code>new_knitr_document</code>, <code>new_tex_assignment</code>, <code>new_tex_letter</code>) in case you prefer those. Add the following to your <code>.bashrc</code> or <code>.zshrc</code> to load them:
|
||||
|
||||
[[ -f ~/tex/cdsc_tex/cdsc_tex_aliases.sh ]] && source ~/tex/cdsc_tex/cdsc_tex_aliases.sh
|
||||
|
||||
== 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 <code>make vc</code>
|
||||
|
||||
\input{vc}
|
||||
\pagestyle{cdsc-page-git}
|
||||
|
||||
One problem is 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 [https://texdoc.org/serve/memoir/0 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, clone the repository, make your changes, and use <code>git format-patch</code> to generate patch files to email directly to mako at <code>mako@atdot.cc</code>. For example:
|
||||
|
||||
git format-patch origin/master
|
||||
git send-email *.patch
|
||||
|
||||
== Installing TeX on your computer ==
|
||||
=== Debian/Ubuntu Installation Instructions ===
|
||||
|
||||
First, you'll want to install the following packages:
|
||||
|
||||
* 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 [https://ctan.org/pkg/urw-garamond 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 macOS ===
|
||||
|
||||
To install with MacTeX, you need to install the font:
|
||||
|
||||
wget https://tug.org/fonts/getnonfreefonts/install-getnonfreefonts
|
||||
texlua install-getnonfreefonts
|
||||
sudo getnonfreefonts-sys garamond
|
||||
|
||||
Reference in New Issue
Block a user