Writing your PhD
Step one
Sit down to write.
Source.
Why?
- The right editor can make a big difference.
- A good editor will:
- enable code snippets
- have bibliography integration
- let you compile LaTeX directly
- help you manage your project
- save you a lot of typing
Why?
- An excellent text editor will:
- be easily customisable
- work cross platform
- have direct git integration
- do half the work for you
Which editor?
- Often users will stick with the editor that comes with the LaTeX installation.
- = TexShop
- = Texworks
- = Various
- Often they are not the most sophisticated editors.
- Advanced features may be difficult to configure.
Which editor?
- In my experience, the following are the best editors.
- None are LaTeX specific, but for software development.
- All (except Sublime) are open source.
- Good: they are more advanced, and have bigger
communities working on them.
- Bad: they come with bigger installations and use
more system resources.
Atom
- Highly Customisable
- Excellent LaTeX integration
(latextools package)
- Direct git integration
- Excellent unicode insertion.
- Occasional difficulties with large files.
- Smaller community compared to Sublime and VSCode
Sublime Text
- Similar to Atom, but proprietary (i.e. not open source)
- Not free, but kinda free.
Sublime Text
- Excellent LaTeX integration (also latextools package)
- Less buggy than Atom
- Looks beautiful.
- Unicode character insertion not good (anymore).
- Git integration ok, but takes some setting up.
Visual Studio Code
- Made by Microsoft, but open source.
- Probably the best all-round text editor.
VS Code
- Excellent git integration (Microsoft own Github)
- Very stable
- Very easy to customise
- Unicode integration is outstanding.
- LaTeX integration not great.
- Reverse search difficult to configure
- Bibliography search not as good as others.
Emacs
- Open Source.
- Long history, big community
Emacs
- Small installation.
- Lots beyond LaTeX
- Excellent LaTeX integration through AUCTeX and RefTeX.
- You can play tetris/snake etc ð
- Not intutive to customise (lisp script, GUI very dense)
- No project overview by default, but possible.
- You can play tetris/snake etc ð
Vim
- Terminal editor
- Long history, large community
- Small installation
- LaTeX integration through VimLaTeX or vimtex.
- Bonus: You look objectively more awesome
writing in a terminal window ð
(I don't use Vim enough to give advantages/disadvantages)
Using your editor the right way
Getting started
- Download your editor of choice.
- Install LaTeX builder.
- Install LaTeX language support.
- Go.
Demo
- Go to https://atom.io, download and install.
- Open, hit
ctrl+,
/cmd+,
and click
'install' on the left.
- Search 'latextools' and install it
- Search for 'language-latex'
- Search for and install 'pdf-view'
- Now, you're good to go.
RMarkdown
- If you use RMarkdown, there is no dedicated environment, like RStudio.
- But, you can follow the above steps to enable markdown support, then call knitr from your terminal.
- To do so, run the commands:
$ R
> install.packages('rmarkdown')
> rmarkdown::render('FILE.Rmd')
Atom + Latextools: Basic Workflow
- Open .tex file.
- Write something latex-y
- Hit
ctrl-alt-b
or cmd-alt-b
- It should then open in the pdf-viewer at the side.
Other commands: latextools
ctrl-l escape
/cmd-l escape
= close console
ctrl-l ctrl-n
/cmd-l cmd-n
= wrap in environment
ctrl-l j
/cmd-l j
= jump to pdf
Saving yourself time: snippets
- Atom, Sublime, VSCode etc. allow you to define your own pieces of code, that insert wider
chuncks.
- Idea
- type a sequence of characters (snippet) and hit
tab
.
- The content of the snippet will then be inserted
Writing Snippets in Atom
- Snippets need four things:
- Scope = which language it will work in
- Name = for comprehension
- Prefix = the shortcut
- Body = what is inserted
Clarity
- Useful for non-latin characters and diacritics.
- LaTeX markup is messy, especially with symbols.
- Some are intutive:
\v{s}
= sĖ
- Others are not:
\textipa{@}
= É
Unicode
- Unicode is useful because you type the characters directly, using a standardised code.
- Requirements:
- Unicode compatible font.
- The right code.
- Ability to input the code.
Unicode: Advantages
- Your writing is a lot more readable in the editor.
- You can reuse the code: just copy paste into email, markdown documents, excel, word etc.
- Works well in bibliographies (with Biber).
Inputing the code
- System:
ctrl-shift-u
in linux.
- Within the editor:
- Atom: Character Table
- VSCode: Insert Unicode
- Emacs:
ctrl-x 8 enter
- Sublime: not honestly sure. There used to be Character Table, but it's disappeared of late.
Handling larget documents
- For a thesis, it's a good idea to keep each chapter as its own file, and compile from a master file.
- Use the
\include{}
command.
- (or use
\input{}
)
\documentclass{memoir}
...
\title{Thesis}
\author{G. K. Candidate}
\date{Summer 2020}
\begin{document}
\include{intro.tex}
\include{theoretical_background.tex}
\include{content1.tex}
\include{content2.tex}
\include{conclusions.tex}
\printbibliography
\end{document}