Difference between revisions of "LaTeX"

From UCT EE Wiki
Jump to navigation Jump to search
m (fixed grammar)
 
(11 intermediate revisions by 2 users not shown)
Line 31: Line 31:
 
[https://www.overleaf.com Overleaf] is an online collaborative Latex editor. It is recommended you use Overleaf, as it has plenty templates which you can draw from and doesn't require any installation or package management.
 
[https://www.overleaf.com Overleaf] is an online collaborative Latex editor. It is recommended you use Overleaf, as it has plenty templates which you can draw from and doesn't require any installation or package management.
  
== Detexity ==
+
=== Using Overleaf ===
 +
Once you have created an account on Overleaf, you need a template to work from. See below for a list of templates.
 +
 
 +
* In Overleaf, click “New Project” and select “Upload Project”
 +
* Select or drag the report template zip file you downloaded from Vula
 +
* The template will load and you will be able to edit it.
 +
* Note: you will need to change the “Main document” in the Menu when editing your document to be “Report.tex”
 +
* Note: You will not be able to compile the source into a pdf if you are viewing ''Preamble.tex''
 +
 
 +
== TexStudio ==
 +
 
 +
[https://www.texstudio.org/ TexStudio] is easy to use tool for writing Latex providing a split view of your tex text on the one side and what it looks like (the generated pdf) on the other side. The TextStudio developers state that their "goal is to make writing LaTeX as easy and comfortable as possible", and will likely feel they are achieving this if you give the tool a try. It has menu options and allows short-cut keys for applying various formatting commands (like Ctrl-B to make selected text boldface). For Latex beginners, you will probably still want to have a site like [https://www.learnlatex.org/en/ LearnLatex.org] open while your developing your document as its formatting menus and other support are pretty good but not so complete for complex documents (e.g. such as for preparing a dissertation or academic paper that may involve more complicated formatting structures, math symbols etc.) .
 +
 
 +
== Detexify ==
  
 
[http://detexify.kirelabs.org/classify.html Detexify] is a web app you can use to find Latex codes for specific symbols.
 
[http://detexify.kirelabs.org/classify.html Detexify] is a web app you can use to find Latex codes for specific symbols.
Line 43: Line 56:
 
[http://www.citationmachine.net/bibtex/cite-a-website Citation machine] can be used to easily generate BibTex.
 
[http://www.citationmachine.net/bibtex/cite-a-website Citation machine] can be used to easily generate BibTex.
  
= Using Overleaf =
+
== Convert Word to Tex and Tex to Word ==
  
Once you have created an account on Overleaf, you need a template to work from. See below for a list of templates.
+
I get asked this often: I've for together a Word document but now want to convert it to Latex. Or I've got a tex document and the publisher want a docx together with the submitted paper. While it tends to end up being the best quality if you work in tex directly, there are a number of good tool solutions to do these conversions. Here are some suggestions:
 +
 
 +
* [http://www.abisource.org/ AbiWord] This tool has an impressive range of file formats supported. You need to install / compile it from source on Linux (it is not supported for Windows or other operating systems). Installation info at [https://flathub.org/apps/details/com.abisource.AbiWord Abisource.AbiWord].
 +
* [http://writer2latex.sourceforge.net/ Writer2Latex] This is a collection of tools for converting from Open Document format to Latex (and other formats like HTML5). Obviously, if using this to convert from DOCX you would first need to export to ODF using Word or OpenOffice.
 +
* [https://www.docx2latex.com/ Docx2Latex] This online app provides good quality results, although it seems focused on going from a docx to a Latex-generated pdf. You are asked to sign up with an email. You may want to first try one of the options that doesn't require you to sign up.
 +
 
 +
== Lyx ==
  
* In Overleaf, click “New Project” and select “Upload Project”
+
[https://www.lyx.org/ LyX] is a word processing tool aimed at providing a WYSIWYM (What You See Is What You Mean) approach to developing latex documents. If you like the approach of editing a document pretty much in the way it will look in the final version, as is usually done for Word document and Open Office documents, then this may be a tool suited to your preference. Certainly it has become a mature tool, been around for many years and a large user community has developed. From experience of using this tool, a bottleneck to its use is the need for a suitably prepared starting-point document, it is not necessarily so easy as just opening a general Latex template and start using it immediately. It may take a bit of configuration and adjusting compiler settings, putting things in the right path etc. for the tool to work as needed. But once it is going and working nicely with the document layout and formatting you are using, it can certainly be a very quick way for developing high quality (Latex output quality) documents. Certainly something you may want to explore further. Good training materials and books (e.g. [https://frommindtotype.wordpress.com/lyx-book/ "LyX, The Other Way of Writing"]) are available for this tool.
* Select or drag the report template zip file you downloaded from Vula
 
* The template will load and you will be able to edit it.
 
* Note: you will need to change the “Main document” in the Menu when editing your document to be “Report.tex”
 
* Note: You will not be able to compile the source into a pdf if you are viewing ''Preamble.tex''
 
  
 
= Templates =  
 
= Templates =  
 
Templates are a good way to get started with a LaTeX project. You should not be creating templates from scratch. Overleaf has a selection of templates, but these are ones found useful in the department. You may still need to add and adjust preamble contents for packages, changes in style, etc.
 
Templates are a good way to get started with a LaTeX project. You should not be creating templates from scratch. Overleaf has a selection of templates, but these are ones found useful in the department. You may still need to add and adjust preamble contents for packages, changes in style, etc.
  
[[File:IEEE Conference Template.zip|thumb]]
+
; Templates
 +
 
 +
; The IEEE Conference Template : [[File:IEEE Conference Template.zip|thumb]]
 +
; [[Templates for Articles, Dissertations and Reports]] (TADR) collection of useful contributes that may be useful to students in the EE department and used for some course project reports.
 +
; An example large template report, useful for final year projects and as a starting point for other write ups
 +
: [[File:Large Template.zip|thumb]]
 +
:There are two cover pages here, one for a general report, another for a formal dissertation hand in.
 +
; The originals are available at https://www.ieee.org/conferences/publishing/templates.html

Latest revision as of 13:11, 14 July 2021

Overview[edit]

LaTeX is a great way to write documents, and is required for use in all your documents to be submitted for this course. LaTeX is better than basic text editors such as Microsoft Word or Google Docs due to the following points, adapted from this stack exchange question:

Dealing with mathematical notation.
Layout and entry are generally easier using LaTeX than some other sort of equation editor. Online tools such as Detexify make it very simple to find the symbol you need.
Consistent handling of intra-document references and bibliography.
As of a couple of years ago the major editors still had problems with re-numbering cross-references and bibliography items. This is never a problem with BibTeX or LaTeX.
Separation of content and style.
In principle this means that you can write your document without caring how it is formatted, and at the end of the day wrap it in the style-file provided by the journal publisher before submission to conform to the house style. In practice some of the journal publishers demand special formatting commands that partially moots this process. Furthermore recent versions of Word and LibreOffice Writer, when properly used, should be able to keep track of various levels of section heading separate from the body text, and apply uniform styling to each level. The gap is somewhat closing.
Tables and illustrations.
With online tools such as Tables Generator, creating tables in LaTeX is as simple as copy-pasting data from excel. Images can be inserted exactly where you specify them without worrying about justification or overlay.


There are a few difficulties with LaTeX. These include:

  1. Difficulties with collaborative editing (consider the convenience of Google Docs)
  2. Spell check (Microsoft Word has a much more advanced spell and grammar check)
  3. Ease of use (LaTeX is technically a “document preparation system” as opposed to a text editor)


However, many if not all of these issues are mitigated by the use of an online tool known as Overleaf. Overleaf provides you with templates, the ability to collaborate, and (thankfully), a spell check function. It runs in browser and doesn’t require any installation.

If you would like to run an offline version, there are various options, but Visual Studio Code with the Latex Workshop Plugin is suggested. For more details on Setting this up, see Visual Studio Code.

Useful LaTeX Tools[edit]

Overleaf[edit]

Overleaf is an online collaborative Latex editor. It is recommended you use Overleaf, as it has plenty templates which you can draw from and doesn't require any installation or package management.

Using Overleaf[edit]

Once you have created an account on Overleaf, you need a template to work from. See below for a list of templates.

  • In Overleaf, click “New Project” and select “Upload Project”
  • Select or drag the report template zip file you downloaded from Vula
  • The template will load and you will be able to edit it.
  • Note: you will need to change the “Main document” in the Menu when editing your document to be “Report.tex”
  • Note: You will not be able to compile the source into a pdf if you are viewing Preamble.tex

TexStudio[edit]

TexStudio is easy to use tool for writing Latex providing a split view of your tex text on the one side and what it looks like (the generated pdf) on the other side. The TextStudio developers state that their "goal is to make writing LaTeX as easy and comfortable as possible", and will likely feel they are achieving this if you give the tool a try. It has menu options and allows short-cut keys for applying various formatting commands (like Ctrl-B to make selected text boldface). For Latex beginners, you will probably still want to have a site like LearnLatex.org open while your developing your document as its formatting menus and other support are pretty good but not so complete for complex documents (e.g. such as for preparing a dissertation or academic paper that may involve more complicated formatting structures, math symbols etc.) .

Detexify[edit]

Detexify is a web app you can use to find Latex codes for specific symbols.

Tablesgenerator[edit]

Tablesgnerator is a website for easily creating Latex tables. You can copy-paste tables from other applications such as Excel.

Citation Machine[edit]

Citation machine can be used to easily generate BibTex.

Convert Word to Tex and Tex to Word[edit]

I get asked this often: I've for together a Word document but now want to convert it to Latex. Or I've got a tex document and the publisher want a docx together with the submitted paper. While it tends to end up being the best quality if you work in tex directly, there are a number of good tool solutions to do these conversions. Here are some suggestions:

  • AbiWord This tool has an impressive range of file formats supported. You need to install / compile it from source on Linux (it is not supported for Windows or other operating systems). Installation info at Abisource.AbiWord.
  • Writer2Latex This is a collection of tools for converting from Open Document format to Latex (and other formats like HTML5). Obviously, if using this to convert from DOCX you would first need to export to ODF using Word or OpenOffice.
  • Docx2Latex This online app provides good quality results, although it seems focused on going from a docx to a Latex-generated pdf. You are asked to sign up with an email. You may want to first try one of the options that doesn't require you to sign up.

Lyx[edit]

LyX is a word processing tool aimed at providing a WYSIWYM (What You See Is What You Mean) approach to developing latex documents. If you like the approach of editing a document pretty much in the way it will look in the final version, as is usually done for Word document and Open Office documents, then this may be a tool suited to your preference. Certainly it has become a mature tool, been around for many years and a large user community has developed. From experience of using this tool, a bottleneck to its use is the need for a suitably prepared starting-point document, it is not necessarily so easy as just opening a general Latex template and start using it immediately. It may take a bit of configuration and adjusting compiler settings, putting things in the right path etc. for the tool to work as needed. But once it is going and working nicely with the document layout and formatting you are using, it can certainly be a very quick way for developing high quality (Latex output quality) documents. Certainly something you may want to explore further. Good training materials and books (e.g. "LyX, The Other Way of Writing") are available for this tool.

Templates[edit]

Templates are a good way to get started with a LaTeX project. You should not be creating templates from scratch. Overleaf has a selection of templates, but these are ones found useful in the department. You may still need to add and adjust preamble contents for packages, changes in style, etc.

Templates
The IEEE Conference Template 
File:IEEE Conference Template.zip
Templates for Articles, Dissertations and Reports (TADR) collection of useful contributes that may be useful to students in the EE department and used for some course project reports.
An example large template report, useful for final year projects and as a starting point for other write ups
File:Large Template.zip
There are two cover pages here, one for a general report, another for a formal dissertation hand in.
The originals are available at https://www.ieee.org/conferences/publishing/templates.html