26 April 2015

LaTeX Thesis Template with incredible documentation and concatenation of files and packages, etc.

latexthesistemplate-2014-07-11.zip

This will take you down the rabbit hole, but it's written more like a choose-your-own-adventure.  You know where you're going and why, and when you get there, it's clear what the next turns are.

There's 63 files in 7 folders, but LaTeXtemplate.tex explicitly states which file is being called from where, so it's easy to pop that one (and any subsequent ones) open to read what's going on.  Yes, I said read as in it's well-documented so you can read most of it in English; you don't have to interpret, infer, and research each term.  In many cases most options are included and documented for each package, even the 'unnecessary' ones, which are commented out.  This makes for easy switching between document styles, for instance.

There's excellent documentation included in a separate PDF that even includes some analysis on compilation time depending on what parts are used and discussion about package incompatibilities and loading orders.

I won't pretend to comprehend it all; it won't immediately run on my computer (it seems to be calling files I don't have, and I've not tried to fix it), but for explanation, this is an excellent resource I'll be saving.

07 April 2015

\usepackage{} -- textcomp & \celsius vs. {\textcelsius}

So far the only way I've found to properly insert ˚C is to

\usepackage{textcomp}

...

{\textcelsius} % Note this won't work in math mode.  No different spacing is needed around this.

_____________

{\celsius} % Does not work.
\celsius % Does not work, even in math mode.
\textcelsius % Does not work.

I had previously found an online forum that suggested using $^{\circ}$C every time, but that's tedious, ONLY works in math mode, and had caused some errors.

05 April 2015

Spaces Following Abbreviations, and A Cautionary Tale

# 7 on Reed College's Ten Strange Things You Need to Know about LaTeX says:
  • LaTeX will always force a slightly larger space after a period, but with abbreviations like etc., an extra space is incorrect. Place a \ character directly before a period that should not have any space, and put \thinspace directly after. For periods after single letters ( E. coli), LaTeX does not use an extra-large space. Thus, to get et al. and etc., write: et al.\thinspace and etc\.,
Do your own testing.  Limits of typesetting on blogger.com mean I cannot show exactly what my TeXshop version produces, and I suspect it has more specific programming included than is believed by that guide. 



\emph{E. coli} et al. etc.,

     % E. coli et al. etc.,  
     % This line looks best overall.


\emph{E\. coli} et a\l. etc\.,

     % Eċoli et alėtc; 
     % This line has has a "dot-c", a "dot-e", is missing two spaces, and has a squished semi-colon.

\emph{E.\thinspace coli} et al.\thinspace etc.\thinspace,  
     % E. coli et al. etc. ,   
     % E. coli looks best here.  Not enough space after et al.  Obvious space after etc. ,

I think I'll stick with regular spaces unless otherwise indicated by the thesis editing officers.

\usepackage {} -- Float (for Figures, Tables, and Captions)

 \usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])  
\renewcommand{\textfraction}{0.20} % \textfraction ≥ 0.15
     % 0.20 is the default, meaning floats will not cover more than 80% of text page.
\renewcommand{\topfraction}{0.70} % \topfraction ≤ 1 - \textfraction
     % 0.70 is default; prevents float with height > 70% of \textheight placed at top of text page.
\renewcommand{\bottomfraction}{0.30} % \bottomfraction ≤ (1 - \textfraction) AND ≤  \topfraction
     % 0.30 is default; prevents float with height > 30% of \textheight placed at bottom of text page.
\renewcommand{\floatpagefraction}{0.50} % \floatpagefraction ≤ (\bottomfraction - 0.05)
     % 0.50 is default; minimum fraction of float page that must be occupied by floats.


__________
 
A 'float' makes a container for a figure or table with a caption, and ensures that neither the element nor the caption is broken across multiple pages.  LaTeX does its best to ensure nice layout, but it's not always good at keeping relevant items on the same page.  Beware of attempting to force float placements.  If LaTeX cannot place one, it will usually have issues with the following ones as well.  Float specifier [options].

The \renewcommand options need not be specified if no changes are made.  If used, they are placed in the preamble.  More on customizing floats in CTAN's epslatex.pdf. 

\usepackage{} -- graphicx vs. graphics vs. psfig/epsfig

Using \usepackage{graphicx} is preferable to \usepackage{graphics} because although "both packages have the same capabilities, ... the resulting syntax may be more cumbersome [with the graphics package]."  TUGboat, Volume 17 (1996), No. 1, "Tutorials" (p. 43) -- PDF,

With \usepackage{graphicx}, "you can incorporate graphics in pdf, jpg, png or tif (with one f) formats. If you don't specify the file extension, it will look for and use whichever one is available."  However you may need \usepackage{graphics} if you have .eps graphics.

% \usepackage{psfig} and \usepackage{epsfig} are obsolete. (Link here.)
% \usepackage{epsf} % Obsolete, low-level typesetting of Encapsulated PostScript (EPS) files.

\usepackage{} -- Caption

\usepackage[hang, small,font=sf,labelfont=bf,up,rm,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures  _NEED REF_

...

hang indicates hanging indent (I think, because I've not found this exact usage indicated in any documentation yet).

small indicates the relative font size.  Something somewhere mentioned that using relative font size is preferable to an absolute font size -- I'm not sure why, and I'm certain that some journals and thesis departments require a particular font size, e.g. 10pt.

font=sf defines the fonts for the labelfont and textfont entirely.
    sf is sans-serif. 

labelfont=bf,up,rm defines the label, number, and separator, e.g. Figure 1:
     They will be (in this case) bold, upright, and Roman.  Roman is the default, however since I defined my captions as sf, rm here makes the labelfont serif.

textfont=it,up defines the font of the caption text, in this case italic and upright.

04 April 2015

\begin{figure} -- Including Figures


\usepackage[hang, small,font=sf,labelfont=bf,up,rm,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures  (Internal link here.)
\usepackage{graphicx(Internal link here.)
\usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [h] (e.g. \begin{table}[h])  (Internal link here.)
...
 
\begin{figure}[!htb] %(Lname2000_Fig7b.png)
            \centering
            \includegraphics[width=4 in]{./img/Lname2000_Fig7b}\\
            \captionof{figure}{Caption text.  May include math mode, e.g., $T_m = 414 \pm 3 K$, and commands such as \emph{emphasized text} and \ldots, as well as citations.{~\cite[Fig.~7b]{Lname2000}}}
            \label{fig:Lname2000_Fig7b}             
\end{figure}

_______________________

Using \begin{figure} \centering is preferable to another format such as \begin{center} This opens the environment.  (Internal link here.)

 The options [!htb]:       (Internal link here.)
    ! overrides the standard float options.
    h, here (in text)
    t, top (of page)
    b, bottom (of page)
    p, page (for floats), meaning a page that only has float element(s) such as figure(s).  This is a good option for large figures that would overwhelm a regular page of text.  I've not used [p] and I need to read more about it before I'm comfortable with it.
    H, "somewhat equivalent to h!" seems to be more pushy than 'h'

I've seen both ! first before other options and last after the others.  I've found nothing definitive that indicates whether order matters.

I use comment the \begin figure with %(Lname2000_Fig7b.png) for my own sanity.  I use LastnameYear to reference articles, and the _Fig7b is the figure as numbered in that article that I'm including.  (This is a literature review / summary I edit on a weekly basis in preparation for weekly meetings with my adviser.)

I keep all of my images in a folder titled 'img' inside my TeX folder for that project, so ./img/filename tells LaTeX to look for the 'img' folder within the current folder, and then find the named file in there.  This keeps my TeX folder tidier.

\includegraphics[width=4 in]{./img/Lname2000_Fig7b}
\includegraphics[width=0.67\linewidth]{./img/Lname2000_Fig7b}

Note one version has an absolute measurement, and the other has a fraction (0.67) of the \linewidth.  Both are valid.  One might be easier than the other, depending on your document.

\captionof{figure}{Caption text.} vs \caption{Caption text.} ... These have different purposes/effects. 
\captionof{table} or other elements work in this manner.  (Internal link here.)


\emph{emphasized text} vs. \textit{italicized text} -- If your captions are already italicized, \textit won't show any effect.  \emph can be nested such that an emphasized phrase within an italicized phrase will look like this.  (Internal link here.)


{~\cite[Fig.~7b]{Lname2000}}  ~ is a non-breaking space.  [Fig.~7b] is an [option] to include a specific element or page number from the reference.  (Internal link here.)

\label{fig:Lname2000_Fig7b} "fig" is a user-set class.  I also use "tbl" for tables.  "Lname2000_Fig7b" is user set too, but I recommend you adopt a naming algorithm that makes labels and citations easy to remember.

\label MUST be on the line immediately following \caption to work.  (Internal link here.)


\end{figure} closes the environment.

\label{} for internal referencing, e.g. Figure and Table numbering.

\label{fig:Lname2000_Fig7b} "fig" is a user-set class.  I also use "tbl" for tables.  "Lname2000_Fig7b" is user set too, but I recommend you adopt a naming algorithm that makes labels and citations easy to remember.

\label MUST be on the line immediately following \caption to work. 

\cite{} for Citations

{~\cite[Fig.~7b]{Lname2000}}  ~ is a non-breaking space.  [Fig.~7b] is an [option] to include a specific element or page number from the reference. 

\begin{figure} \centering vs. \begin{center}

\centering doesn't leave vertical space before and after it. 

\begin{center} is an environment.  Also, the \centering command does not start a new paragraph.

Using \begin{figure} \centering is thus preferable to \begin{center}.

\emph{emphasized text} vs. \textit{italicized text}

\emph{emphasized text} vs. \textit{italicized text} -- If your captions are already italicized, \textit won't show any effect.  \emph can be nested such that an emphasized phrase within an italicized phrase will look like this. 
_NEED REF_

\captionof{element}{Caption text.} vs \caption{Caption text.}

\captionof{figure}{Caption text.} vs \caption{Caption text.} ... _NEED REF_ These have different purposes/effects. 
\captionof{table} or other elements work in this manner.

Use LaTeX on different platforms (Mac & Windows) with Overleaf.com?

Is there a sane way to use LaTeX on different platforms (Mac & Windows) without losing work or sanity?

I'm going to try Overleaf.com.

\usepackage{} -- Font Colors (for Drafts)

% Package(s) for drafts; for printing font colors (used for printing notes in drafts).
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % to add comments in color, offers more colors than \usepackage{color} 
     % Use this in the form of {\color{declared-color} some text}, because this "environment allows the text to run over multiple lines and other text environments."
     % Predefined colors -- note that at least in my experience, colors must be capitalized as they are in this list, e.g., OliveGreen, not olivegreen.

\usepackage{} -- Dummy Text (for Drafts)

% Package(s) for drafts; for layout and internal (printing) notes.
\usepackage{lipsum} % Generates dummy text throughout a template "Lorem ipsum dolor..."

A multi-TeX-file thesis template with some introduction to simpler elements.

University of Oregon's Thesis and Dissertation LaTeX site.

It might be a bit under-automated, or a bit over-divided, as I'm not sure the abstract and the dedication need separate files.

A marvelously detailed, well-commented thesis package (even if it is in one document): "Using LaTeX for thesis writing..."

Using LaTeX for thesis writing at the University of Washington.

The author mentions he set it up as a single file in order to make file-sharing simpler, but it doesn't seem entirely clear how to set it up in the multiple-TeX-file format he suggests.

The Best Introductory Overview to LaTeX (so far) "LaTeX Your Document"

LaTeX Your Document by Reed College's CIS Help Desk

While I don't have access to their Thesis documents, this has been the best overview and step-by-step introduction yet.  It does not address using LaTeX on different operating systems (Mac at home and Windows in the lab, for example).

The Lazy Mathematician's blog covering drawing, lists, graphs, plots, functions, and page layout.

The Lazy Mathematician's blog.

I haven't delved into this yet, but I'm keeping it for later reference.