LaTeX: Difference between revisions
m →Creating a new resource: Complete, ready-to-compile sample scripts are very useful. |
|||
(29 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
⚫ | '''LaTeX''' is a [[markup language]] (as is [[MediaWiki]]!) for producing mathematical texts of the highest quality. Its use is widespread in the mathematics world. It is built on plain [[w:TeX|TeX]] developed by [[W:Donald Knuth|Donald Knuth]]. You can embed LaTeX markups in MediaWiki by the <nowiki><math></math></nowiki> tags, e.g. <kbd><nowiki><math>e = m c^2</math></nowiki></kbd> is rendered as <math> e = m c^2</math>. |
||
:''See also: [[special:prefixindex/LaTeX/|List of resources under LaTeX]]'' |
|||
⚫ | '''LaTeX''' is a [[markup language]] (as is [[MediaWiki]]!) for producing mathematical texts of the highest quality. Its use is widespread in the mathematics world. It is built on plain [[w:TeX|TeX]] developed by [[W:Donald Knuth|Donald Knuth]]. You can embed LaTeX markups in MediaWiki by the <nowiki><math></math></nowiki> tags, e.g. < |
||
== Readings == |
|||
* [[Wikipedia: LaTeX]] |
|||
* [[Wikibooks: LaTeX]] |
|||
==Installation== |
==Installation== |
||
*If you are using Linux, you probably have it already! Just type "latex". |
*If you are using Linux, you probably have it already! Just type "latex". |
||
*If you are using Windows, the simplest thing to do is to open [[w:cygwin|Cygwin]] (the linux emulator) and type "latex". If you haven't installed Cygwin, do it! You will often find it useful. The installation may take less than an hour but it is usually straightforward. |
*If you are using Windows, the simplest thing to do is to open [[w:cygwin|Cygwin]] (the linux emulator) and type "latex". If you haven't installed Cygwin, do it! You will often find it useful. The installation may take less than an hour but it is usually straightforward. |
||
** Note that it is now fairly simple to install a [[linux dual boot]], for example, with [[wubi]]. All you need is a number of Gigabytes in a refactored hard-drive. You can delete it like a regular windows directory whenever you don't want it any more. |
|||
==Step by step guide for beginners== |
==Step by step guide for beginners== |
||
#Create a file with .tex suffix, e.g. "helloworld.tex" (see [[/helloworld.tex]]). |
#Create a file with .tex suffix, e.g. "helloworld.tex" (see [[/helloworld.tex]]). |
||
#Go to your linux/cygwin/whatever shell, go to the directory of your file "helloworld.tex" and type "latex helloworld". |
#Go to your linux/cygwin/<ref>If you are new to cygwin, you can find your c-drive by something like <kbd>cd /cygdrive/c</kbd> </ref> whatever shell, go to the directory of your file "helloworld.tex" and type "latex helloworld". |
||
#A [[w:dvi|.dvi]] file will be created - you may view it directly if you have the right tools. |
#A [[w:dvi|.dvi]] file will be created - you may view it directly if you have the right tools. |
||
#If not, type "dvips helloworld" or type "dvipdf helloworld" to convert it to a [[w:postscript|postscript]] or [[w:pdf|PDF]] file. |
#If not, type "dvips helloworld" or type "dvipdf helloworld" to convert it to a [[w:postscript|postscript]] or [[w:pdf|PDF]] file. |
||
Line 16: | Line 20: | ||
A good editing environment helps! A useful and free option is the [[w:LaTeX-Editor_(LEd)|LaTeX editor (LEd)]] ([http://www.latexeditor.org/ see their home page]). |
A good editing environment helps! A useful and free option is the [[w:LaTeX-Editor_(LEd)|LaTeX editor (LEd)]] ([http://www.latexeditor.org/ see their home page]). |
||
A [http://ooolatex.sourceforge.net LaTeX extension] is also available for [[Open Office]]. |
|||
==Creating a new resource== |
|||
You are welcome to create a new learning resource for LaTeX! |
|||
Or for a quick and easy solution, try [http://rogercortesi.com/eqn/index.php Roger's Online Equation Editor]. |
|||
Complete, ready-to-compile sample scripts are very useful. |
|||
== Lessons == |
|||
* [[/helloworld.tex/]] |
|||
* [[/Including graphics/]] |
|||
* [[/Inserting diagrams/]] |
|||
* [[/Two-lined-subscripts/]] |
|||
* [[/Serial letter/]] |
|||
==Obtain PDF from Latex== |
|||
pdflatex hello.tex |
|||
== Use Latex Source in Wikiversity == |
|||
You can use latex sources also in Wikiversity. In general you will create a PDF file from your latex source. <kbd>pdflatex</kbd> converts the a tex-file <kbd>hello.tex</kbd> in <kbd>hello.pdf</kbd>. You may need sometimes a different output format. If you want to convert the tex-file into a Wiki markdown output for Wikiversity you can use [https://pandoc.org/try PanDoc]. |
|||
=== Pandoc === |
|||
This is useful if you want to use parts from source text in LaTeX also in a Wikiversity learning resource (e.g. for a mathematical text for a lecture). Copy the source in [https://pandoc.org/try PanDoc] and |
|||
* select [https://pandoc.org/try "Latex" as input format] and |
|||
* select [https://pandoc.org/try "MediaWiki" as an output format]. |
|||
When press [https://pandoc.org/try "convert"] you can use the Wiki source code in your learning resource. |
|||
=== Expand Newcommands === |
|||
<inputbox> |
|||
Sometimes it is necessary to [https://niebert.github.io/closingbracket expand latex macros] because the macros in your source are not available in Wikiversity. |
|||
type=create |
|||
* With the BracketHandler <kbd>closingbracket.js</kbd> a newcommand replacement into the source text is possible. |
|||
default=LaTeX/ |
|||
* Use [https://niebert.github.io/closingbracket Newcommand Expander] as an [[AppLSAC]] for replacing the newcommand ([https://www.github.com/niebert/closingbracket GitHub Repository closingbracket.js]). |
|||
</inputbox> |
|||
==External Links== |
|||
{{latex-footer}} |
|||
* [http://tex.loria.fr/general/texbytopic.pdf tex by topic] - an indepth study of TeX |
|||
* [https://niebert.github.io/closingbracket closingbracket.js BracketHandler] - GitHub demo for newcommand replacement with [https://www.github.com/niebert/closingbracket GitHub-repository 'closingbracket'] |
|||
== References == |
|||
<references/> |
|||
[[category:LaTeX]] |
[[category:LaTeX| ]] |
||
[[category:mathematics]] |
[[category:mathematics]] |
||
[[category:computer science]] |
[[category:computer science]] |
Latest revision as of 08:43, 8 December 2022
LaTeX is a markup language (as is MediaWiki!) for producing mathematical texts of the highest quality. Its use is widespread in the mathematics world. It is built on plain TeX developed by Donald Knuth. You can embed LaTeX markups in MediaWiki by the <math></math> tags, e.g. <math>e = m c^2</math> is rendered as .
Readings
[edit | edit source]Installation
[edit | edit source]- If you are using Linux, you probably have it already! Just type "latex".
- If you are using Windows, the simplest thing to do is to open Cygwin (the linux emulator) and type "latex". If you haven't installed Cygwin, do it! You will often find it useful. The installation may take less than an hour but it is usually straightforward.
- Note that it is now fairly simple to install a linux dual boot, for example, with wubi. All you need is a number of Gigabytes in a refactored hard-drive. You can delete it like a regular windows directory whenever you don't want it any more.
Step by step guide for beginners
[edit | edit source]- Create a file with .tex suffix, e.g. "helloworld.tex" (see /helloworld.tex).
- Go to your linux/cygwin/[1] whatever shell, go to the directory of your file "helloworld.tex" and type "latex helloworld".
- A .dvi file will be created - you may view it directly if you have the right tools.
- If not, type "dvips helloworld" or type "dvipdf helloworld" to convert it to a postscript or PDF file.
- Use Ghostview to view the .ps file, or the Adobe Acrobat Reader to view the .pdf file.
Choosing an editor
[edit | edit source]A good editing environment helps! A useful and free option is the LaTeX editor (LEd) (see their home page).
A LaTeX extension is also available for Open Office.
Or for a quick and easy solution, try Roger's Online Equation Editor.
Lessons
[edit | edit source]Obtain PDF from Latex
[edit | edit source]pdflatex hello.tex
Use Latex Source in Wikiversity
[edit | edit source]You can use latex sources also in Wikiversity. In general you will create a PDF file from your latex source. pdflatex converts the a tex-file hello.tex in hello.pdf. You may need sometimes a different output format. If you want to convert the tex-file into a Wiki markdown output for Wikiversity you can use PanDoc.
Pandoc
[edit | edit source]This is useful if you want to use parts from source text in LaTeX also in a Wikiversity learning resource (e.g. for a mathematical text for a lecture). Copy the source in PanDoc and
- select "Latex" as input format and
- select "MediaWiki" as an output format.
When press "convert" you can use the Wiki source code in your learning resource.
Expand Newcommands
[edit | edit source]Sometimes it is necessary to expand latex macros because the macros in your source are not available in Wikiversity.
- With the BracketHandler closingbracket.js a newcommand replacement into the source text is possible.
- Use Newcommand Expander as an AppLSAC for replacing the newcommand (GitHub Repository closingbracket.js).
External Links
[edit | edit source]- tex by topic - an indepth study of TeX
- closingbracket.js BracketHandler - GitHub demo for newcommand replacement with GitHub-repository 'closingbracket'
References
[edit | edit source]- ↑ If you are new to cygwin, you can find your c-drive by something like cd /cygdrive/c