demonstrate how to create a latex class
#+TITLE: Homework 1
#+AUTHOR: Yang Liu (N18178005, yl3710)
#+LATEX_CLASS: networkingHomework
# if you want to set more latex headers, check http://orgmode.org/manual/Header-and-sectioning.html#Header-and-sectioning
the output of the command =ls -l= will be:
\begin{lstlisting}
total 3928
-rw-r--r--@ 1 jeremy staff 136188 Sep 18 16:46 EmbeddedObjects.pcapng
-rw-r--r--@ 1 jeremy staff 26856 Sep 18 16:16 RetrievingLongDocuments.pcapng
-rw-r--r--@ 1 jeremy staff 253805 Sep 18 18:52 hw1.pdf
drwxr-xr-x@ 14 jeremy staff 476 Sep 18 12:48 ltxpng
\end{lstlisting}
blah blah blah
; finally you should add your own class into the variable `org-latex-classes'
(add-to-list 'org-latex-classes
("networkHW" "\\documentclass{networkHW}" ;; ONLY this line matters, the rest is just format controlling, just leave them be
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
)
% this is your latex class file, set your preamble (i.e., layout, font size, style...) here
% all class files should start like this, put these tow lines at very begining
\NeedsTeXFormat{LaTeX2e} % indicate the minimum version of LaTex
\ProvidesClass{networkingHomework}[2015/09/18 For my Networking homework] % classname, last modified time, description
% you probably need to load a standard class settings first
\LoadClass[letterpaper, 12pt]{report}
%% your customization starts from here
% use \begin{lstlisting} instead of #+BEGIN_EXAMPLE for command line demo/outputs
\RequirePackage{listings} % don't use \usepackage in a class file
\lstset{basicstyle=\ttfamily\scriptsize} % use a smaller font size so a long line shall not exceed the page edge
% use minted for code block (it supports syntax highlighting)
\RequirePackage[top=1in,bottom=1in,left=1in,right=1in]{geometry} % adjust your layout/margins here
% once you finished, put this file into your tex load path as mentioned above
% Read more
% - https://gist.github.com/jhwilson/1278588 here is a real example of someone's latex class
#!/bin/bash
# find your latex load path
# i.e., where should you put your *.cls/*.sty files
texpath=kpsewhich --var-value=TEXMFHOME
echo "Tex home diretory: $texpath"
# my output is $HOME/Library/texmf
# if the directory hasn't been created, create it
[[ -d "$texpath" ]] || mkdir -p "$texpath"
# following the convention of texmf directory structure
# you should put your class file into /somewhere/texmf/latex/commonstuff/
[[ -d "$texpath/tex/latex/commonstuff" ]] || mkdir -p "$texpath/tex/latex/commonstuff"