Some software tips

Two software I always install

I can't live without TeX, a mathematician's tool of choice to compose mathematics and Git, the best tool for revision management and collaboration. There are many TeX editors but I recommend LawTeX app for Windows 10 for its ease of use, no need to install the heavy MikTeX/TeX Live suite and the fact that it also comes with a handy productivity boosting feature to recompile document as you paused writing so you can "instantly" preview the result.

Two TeX tricks I always use

You can clone this Git repository to get started.

Multiple documents

To prepare a large mathematical document in TeX, one typically works on each section or chapter separately and combine them using TeX mechanism of \input. Unfortunately, one problem with LaTeX document is that they need a preamble in order to be compiled and a document cannot contain two preambles. Consider the following situation: You have the main file

% Main.tex
\documentclass[12pt]{amsart}
\begin{document}
\section{Introduction}
\input{intro.tex}
\end{document}
that you intend for the full article and some section file
% intro.tex
\documentclass[12pt]{amsart}
\begin{document}
Content of the introduction.
\end{document}
for the introduction section. In this example above, you also added the preamble in the second file so that you can compile it while writing its content without having to compile the whole thing over and over again; which is inefficient and might be too distracting. But this set-up won't work because when you compile the main file, you get the double preamble (two declarations of the \documentclass).

To fix this problem, the idea is to use conditional compilation; a method of enable/disable a region of code that C/C++ programmer should be familiar of (the #if ... #endif). In your main file, define a dummy command, say

\let\IsMainDocument\relax
% The rest of Main.tex
right at the beginning of the file and then in your section files, wrap the code that should be disabled when included in the main file, in
\unless\ifdefined\IsMainDocument

% Content that should be disabled if this file is \input-ed to the Main.tex;
% and enabled if this file is compiled as a stand-alone document. For example,
% put the preamble as well as the \end{document} of intro.tex.

\documentclass[12pt]{amsart}
\begin{document}

\fi

% The main content of the intro file

\unless\ifdefined\IsMainDocument

\bibliography{references}{}
\bibliographystyle{plain}
\end{document}

\fi
This way, you can compile both the intro.tex file by itself and when you are done with all the sections, compile the Main.tex file without any modification.

Remark: Since the preamble and postamble are to be shared between sections, it is best to extract common file for them. You should also add all math commands (notations) there to avoid clashing.

Adding turn-off-able personal notes

When writing a paper, one usually wants to add personal notes to include some additional information such as complete proofs, TODO notes, etc. which are to be turned off when publishing. An easy way to accomplish that is to make the command

\newcommand{\PERSONALNOTE}[1]{{\color{blue}{#1}}}
and wrap your note in \PERSONALNOTE, for example
It is easy to see that ...
\PERSONALNOTE{Here is the full proof of the easy claim. Blah blah blah.}
When the paper is ready, comment out the definition and replace it as an empty command
%\newcommand{\PERSONALNOTE}[1]{{\color{blue}{#1}}}
\newcommand{\PERSONALNOTE}[1]{}
Although this works, it leaves much to be desired.
  • One usually wants some numbering of notes, like theorems, in order to easily refer to them when discussing with colleagues.
  • For a long note, it is hard to locate the open/closing braces of the \PERSONALNOTE command.

A better solution is the following: When writing, use

\newtheorem{personalnotes}{Personal Notes}
and put your note similar to theorems or proofs, for example,
\begin{personalnotes}
Here is the full proof of the easy claim. Blah blah blah.
\end{personalnotes}
And finallym, to get the clean version for publishing, comment out the \newtheorem and replace it with comment environment
%\newtheorem{personalnotes}{Personal Notes}
\usepackage{verbatim}
\let\personalnotes\comment
\let\endpersonalnotes\endcomment

Now it is much better since your notes are structured and numbered. See here if you want to style notes, for example, make it in red.

Some Windows 10 Tricks I discover accidentally

Quick shut down

Open command prompt and type the command powercfg.exe /hibernate off

Limiting background activity

Open Settings and look for Battery Saver and turn on battery saver always by putting the slider to 100%. According to Microsoft, battery saver mode will limit background download, push notification, etc. This will disable some malicious applications.

Prevent automatic updates

Windows 10 (as of Fall 2017 update) will not download update if the network connection is a metered connection (i.e. data plan) or the device is in battery saver mode. Obviously, the device can't download update if there is no network connection. Unfortunately, some version of Windows does not allow you to set a WiFi connection as "metered" so the more reliable method is to turn on Battery Saver always. Note that batter saver will be turned off automatically if you plug in. As a mathematician, given this information, I can't help but arrive at the following logical solution:

  • Turn on battery saver always so update will not be downloaded when you are not charging;
  • Turn off WiFi when you are charging.
This will ensure that update will never be downloaded; by virtue of the principle of excluded middle.