Writing assignments in has always been the preferred option, instead of hassling with Word, where equations look horrible, gently speaking. And writing the assignment on paper and then scan is not an option, mainly due to the fact that the probability of being able to read my own notes decays with a halftime of 3 days, approximately. It is quite probable that when you think a solution is done, that you realize it missed some supporting arguments, and then it is quite tedious to rewrite the handwritten papers. The tediousness grow exponentially with the number of times one has to rewrite handwritten papers, true story and pseudo scientifically proven.
However, even with there has been this problem of backup (anyone lost their thesis due to a power break?), tracing changes over time, and reverting changes (maybe you figured out that the first ugly solution was actually correct after being told by your friend that his two line solution was impeccable, but incorrect) . Sure, one can resort to Dropbox, but that would not solve the tracing problem and reverting.
After having coded a bit, one will realize sooner or later that one has to use git, the ubiquitous tool for all developers. git is actually so good that it motivates the use of , where the document is stored in plain text files, which is not the case for word. Admittedly, git is not the easiest program to learn, and in the beginning one will resort to stackoverflow numerous times. But the rewards pay off in the long run. For an excellent short introductory and a perfect reference visit git no deep shit. So for the application of homework assignments, I would set up a repository for a single course like this:
git init
in the folder where the files should be stored. A straightforward file structure that I am using is:
.
├── hw1
│ ├── HW1.tex
│ ├── taskt_5.eps
│ └── taskt_5.svg
├── hw2
│ └── HW2.tex
├── hw3
│ ├── code
│ │ ├── HOUSEHOLDER.m
│ │ ├── HOUSEHOLDER_MULT.m
│ │ ├── Q_HOUSE.m
│ │ └── QR_HOUSE.m
│ ├── HW3.tex
│ ├── ql.m
│ ├── qr_own.m
│ └── task_4.m
├── settings.sty
├── README.md
└── ref.bib
For each assignment in the course create a separate folder where to store the tex file and related files. Then add files to the staging area:
git add HW1.tex
and make a commit
git commit -am 'Done with Problem 1 HW1'
In the structure above there are two important files for the latex documents, settings.sty and ref.bib. In settings.sty, a latex style file, one can store all the latex settings that would go into every homework tex file, so one does not need to copy code across multiple tex files. An example of a sty file I am using is:
\ProvidesPackage{matrixsettings}[2016/05/24 Settings]
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=settings,
prefix=settings@}
\DeclareStringOption[0]{number}[0]
\ProcessKeyvalOptions{settings}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, tabu}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\adj}{adj}
\author{Mr Amazing Student}
\title{Homework \#\settings@number\ Creationism in a Evolutionary Perspective}
The kvoptions package makes it possible to pass arguments to the style file in the tex file:
\usepackage[number=8]{../settings}
Notice that the relative path or absolute path has to be given. Then a tex template for each homework would look like:
\documentclass[12pt,a4paper]{article}
\usepackage[number=8]{../settings}
\begin{document}
\maketitle
\section{Problem 1}
Prove that cats want to exterminate humanity.
\begin{proof}
Visit 9gag.com \cite{9gag}.
\end{proof}
\bibliographystyle{plain}
\bibliography{../ref.bib}
\end{document}
git solves the revision control problem of writing, but not necessarily the backup problem, as git works with local repositories. This is where github comes into action, where it possible to push your own local repository to a remote server. However, if you have a free account on github, it will be visible to everyone, and maybe you want to keep your work to yourself. My university provides an Enterprise version of github, so you can store the repository privately.
A consequence of putting your tex files under revision control, is that it possible to update your solutions after you have submitted it, while being able to recover the version you sent, without cluttering your file system with files like hw1_final.tex, hw1_final2.tex, hw1_final2a_correct.tex,etc. For instance, if the homework was graded or you figured out a much better solution afterwards it would be better for the learning to update the text; maybe someday you will return to the problem and see how you solved it. What a shame if you had to try to dig up a paper from the basement you remembered after three hours of searching throwing into the garbage bin when you moved last time. Additionally, it is nicer to read a solution which is correct than false. Enrico Fermi was rumored to be notorious collector of his own notes.
Written with StackEdit.
No comments:
Post a Comment