First off, you may not want to use LaTeX directly if you want to use it as a whiteboard to develop ideas. You may be better off using Org-mode to draft your paper. You can embed LaTeX in Org-mode and you will probably be more effective than using LaTeX directly. The details on using Org-mode for drafting are not hard to learn, especially if you already use Emacs. Since Org-mode stores files as plain text they can be tracked with version control.
I use git to track some documents I work on and I mostly use it as a safety net. Knowing that every change I do may be recovered is great because I can make big changes to documents without being afraid of losing anything.
When using version control privately, i.e. you are the only one who commits, it may be thought of as using a system to name groups of changes to documents. So to use it effectively you should make changes of one type or to a particular part of your document and describe the change accordingly in the commit message, e.g. commit after you made a couple of changes to your introduction and make another commit for the changes of your conclusion instead of one commit for everything. However you should not be too pedantic with version control, it should not take over your primary work of writing the text. It is more important that you work effectively and write a good text than that you make the most appropriate commits.
My typical work flow is that I make a repository only after I have document with some substantial content. Then I branch off the master by making a dev branch. I commit all new changes to the dev branch and when I have read the whole document or come to a particular stage at which the document is more stable, e.g. when I turn it into my supervisor, I merge the changes in dev to the master. Then for any new changes I branch into a deb branch again. I also use the tag feature of git to mark particular stages, e.g. a version I sent to someone, which makes it easier to find those stages if I need.
To view changes I use different tools. I both use giggle, tig and git log
to see the history of a repository. To compare versions I mostly use meld.
Use one type of project per repository. Grouping things that do not belong together is confusing. Branching is good for making different version of a document, e.g. to split a project into an article and a presentation.
Finally, here is what inspired me to start using version control: http://www.charlietanksley.net/philtex/using-a-version-control-system/
Two objections come to mind:
- If you don't know you will be entering math mode, then you may write something "semantically" correct that breaks.
For example:
\documentclass{article}
\newcommand\mathmacro[1][A]{\ensuremath{{#1}_1}}
\begin{document}
\mathmacro[$x^2$] % The dollar signs *leave* math mode
\end{document}
What's going on here is that \mathmacro[$x^2$]
expands to
\ensuremath{{$x^2$}_1}
which expands to (effectively)
\ifmmode
{$x^2$}_1
\else
${$x^2$}_1$
\fi
and you can see that if you write it outside of math mode, the second branch is taken, so the first dollar sign brings you into math mode and the one at the front of $x^2$
takes you out of it, with the reverse operation happening afterwards. This gives an error.
Of course, you aren't supposed to do that, since \mathmacro
is actually a "math macro usable in text mode", so you should think of the thing between the brackets of its argument as being in math mode. Alas, this confuses both the author and the text editor's syntax highlighting, since it is a nonstandard assumption.
Edit: I would define this macro as:
\newcommand\mathmacro[1][A]{{#1}_1}
and use it as:
$x^2$ sub one: $\mathmacro[x^2]$.
This way, the parts that are math are clearly math.
- In the unlikely event that you or some package sets
\everymath
, you will be very surprised when your apparently text-mode macros start to look different.
On the subject of semantics, though, the issue is clear: \ensuremath
breaks the separation between math and text, which are two very different things. TeX even has the distinction built in: different fonts, different spacing rules, different parsing rules. You can probably construct a lot more counterexamples by exploiting these.
What I mean by this is that in the following situation:
\documentclass{article}
\newcommand\mathmacro[1][A]{\ensuremath{{#1}_1}}
\begin{document}
A sub one: \mathmacro
\bfseries A sub one: \mathmacro
\end{document}
you may be surprised that the bold text does not extend to the contents of the apparently text-mode \mathmacro
.
What I'm saying is not so much that \ensuremath
actually breaks anything as that it violates your expectations to the point that it makes things harder rather than easier.
Best Answer
I'm a user. I have no idea of TeX, plus neither of Lua nor of »expl3«.
I'm a user. I made an installation of texlive or MikTeX on my computer. I read an introduction to LaTeX and learned about some basic packages as well as about what an editor is, why encoding is necessary and about babel / polyglossia. I'm skimming through the manual of every package I'm loading (
texdoc packagename
on the command line produces the manual). If I encounter an issue, I'm able to produce a minimal working example and get help.If I were a template user, I'd have missed much of that. No idea how to discern flagship packages from unmaintained stuff. No way to produce a minimal working example and get help.
Starting with LaTeX with a complex template is like downhill racing on a mountain bike without having ever learned how to cycle on a bike: Hell.