Difference between revisions of "LaTeX"

From PrattWiki
Jump to navigation Jump to search
prattw>JMullen
m
(FAQ)
 
(63 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Software| name=LaTeX|
 
{{Software| name=LaTeX|
 
byline=Document Preparation System|
 
byline=Document Preparation System|
image=|
+
image=[[File:LaTeX logo.png|200 px]]|
 
caption=|
 
caption=|
version=|
+
version=pdfTeXk 3.141592-1.40.3|
 
dlocation=On Unix|
 
dlocation=On Unix|
 
manufacturer=|
 
manufacturer=|
webpage=[http://www.latex-project.org/ Site]|
+
webpage=[http://www.latex-project.org/ <math>LaTeX</math> Project]|
label_color=|Color value_color=|}}  
+
label_color=|Color value_color=|
 +
update=8/26/2019}}  
  
 
'''LaTeX''' is a document preparation system written by Don Knuth (TeX) and extended by Leslie Lamport.  It is a powerful, and free, way to generate professional, dynamic documents.
 
'''LaTeX''' is a document preparation system written by Don Knuth (TeX) and extended by Leslie Lamport.  It is a powerful, and free, way to generate professional, dynamic documents.
  
<br clear=all>
+
==LaTeX on Pratt Pundit==
__TOC__
+
===The Basics===
<br clear=all>
+
 
==External Links==
+
Pratt Pundit can process most basic \(\LaTeX\) structures by using <code><nowiki>\(</nowiki></code> and <code><nowiki>\)</nowiki></code> or math tags  around \(\LaTeX\) code. For example,
*[http://en.wikibooks.org/wiki/Programming:LaTeX Wikibook on LaTeX] - a wiki devoted to LaTeX! ''All kinds'' of good stuff here.
+
<center>
*[[WP:LaTeX|LaTeX]] on Wikipedia - includes several tutorials and references
+
<math>q(t)=q(t_0)+\int_{t_0}^ti(\tau)~d\tau</math>
*Tobias Oetiker's "[http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf#search=%22not%20so%20short%20guide%22 The Not So Short Introduction to LaTeX2e]" - great guide for beginning (and not so beginning) usersShould be version 4.20 (as of 8/26/2006)If that link doesn't work, try
+
</center>
**[http://classes.pratt.duke.edu/EGR53F06/FILES/lshort.pdf Mirror 1] at Duke
+
can be created using
**[http://people.ee.ethz.ch/~oetiker/lshort/lshort.pdf Mirror 2] in Switzerland
+
<source lang="bash">
 +
<center>
 +
<math>q(t)=q(t_0)+\int_{t_0}^ti(\tau)~d\tau</math>
 +
</center>
 +
</source>
 +
 
 +
Equations can also be inline - for instance,  <math>c^2=a^2+b^2-2ab\cos(\theta)</math> is an equation.  The code for that is:
 +
<source lang="latex">
 +
Equations can also be inline - for instance,  <math>c^2=a^2+b^2-2ab\cos(\theta)</math> is an equation.
 +
</source>
 +
 
 +
===Equation Lists===
 +
For multiple equations one after the other, use the <code>\begin{align}</code> environmentThis will allow you to line equations up by placing an ampersand just before the symbol on each line you want as the alignment character. Use \\ to go to the next equationFor example,
 +
<source lang="latex">
 +
<center><math>
 +
\begin{align}
 +
q(t)&=q(t_0)+\int_{t_0}^ti(\tau)~d\tau\\
 +
a&=\left(\frac{dv}{dt}\right)
 +
\end{align}
 +
</math></center>
 +
</source>
 +
produces:
 +
<center><math>
 +
\begin{align}
 +
q(t)&=q(t_0)+\int_{t_0}^ti(\tau)~d\tau\\
 +
a&=\left(\frac{dv}{dt}\right)
 +
\end{align}
 +
</math></center>
 +
 
 +
You can also have multiple equations in the same row:
 +
<source lang="latex">
 +
<center><math>
 +
\begin{align}
 +
L_1&=10~\mbox{mH} & R_1&=15~\mbox{k}\Omega & C_1&=22~\mu\mbox{F}\\
 +
L_2&=18~\mbox{mH} & R_2&=22~\mbox{k}\Omega & C_2&=17~\mu\mbox{F}
 +
\end{align}
 +
</math></center>
 +
</source>
 +
produces:
 +
<center><math>
 +
\begin{align}
 +
L_1&=10~\mbox{mH} & R_1&=15~\mbox{k}\Omega & C_1&=22~\mu\mbox{F}\\
 +
L_2&=18~\mbox{mH} & R_2&=22~\mbox{k}\Omega & C_2&=17~\mu\mbox{F}
 +
\end{align}
 +
</math></center>
 +
===Arrays===
 +
Arrays work perfectly well in Pundit - as long as you don't try to stretch them:
 +
<center><math>
 +
\begin{array}{|c|c|c|}\hline
 +
\mbox{Singularity Function} & \mbox{Name} & \mbox{Alternate Symbol} \\ \hline \hline
 +
<t-a>^0 & \mbox{unit step function} & u(t) \\ \hline
 +
<t-a>^1 & \mbox{unit ramp function} & r(t)=t~u(t) \\ \hline
 +
\frac{1}{2}<t-a>^2 & \mbox{unit parabola function} & p(t)=\frac{1}{2}t^2~u(t) \\ \hline
 +
\end{array}
 +
</math></center>
  
*Andrew Roberts' "[http://www.andy-roberts.net/misc/latex/index.html Getting to grips with LaTeX]" tutorial
+
== Known Issues ==
*The Comprehensive LaTeX Symbol List, Scott Pakin ([http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-letter.pdf PDF], over 100 pages!)
+
* RESOLVED: LaTeX on Pundit didn't know "unnumbered" versions of things, but know it does - behold!
*Short Math Guide for LaTeX, Michael Downes ([ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf PDF], 17 pages)
+
<source lang="latex">
*A more "visual" version of LaTeX:  [http://www.lyx.org LyX].
+
<center><math>
*[http://www.tug.org/texshowcase/ LaTeX Showcase]
+
\begin{align*}
*[http://www.tug.org/mactex/ LaTeX for Macintosh Users]
+
e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!}
 +
\end{align*}
 +
</math></center>
 +
</source>
 +
will cause:
 +
<center><math>
 +
\begin{align*}
 +
e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!}
 +
\end{align*}
 +
</math></center>
 +
which is correct!  Note that using the unstarred version produces:
 +
<source lang="latex">
 +
<center><math>
 +
\begin{align}
 +
e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!}
 +
\end{align}
 +
</math></center>
 +
</source>
 +
to get:
 +
<center><math>
 +
\begin{align}
 +
e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!}
 +
\end{align}
 +
</math></center>
 +
* LaTeX on Pundit does not process changes to the <syntaxhighlight lang=latex inline>\arraystretch</syntaxhighlight> variable - so arrays cannot be stretched or contracted.
  
 
==FAQ==
 
==FAQ==
 +
<!--
 +
===What's the 15-second summary of using LaTeX?===
 +
# Use '''emacs blah.tex &''' to generate the source code.
 +
# Use '''latex blah.tex''' to process the file.  If successful, among other things, you will have a new blah.dvi file.
 +
# Use '''dvipdf blah.dvi''' to create a PDF file from the DVI file.
 +
# Use '''evince blah.pdf &''' to look at (and eventually print) the file.
 +
 +
Note - if you have a \tableofcontents, or a \listoffigures, or any \label and \ref commands, you will want to run the latex step three times before progressing to the evince step.  Also, once you have run evince, you won't need to re-run it each time; evince will always look at the most current version of the pdf file - meaning you '''will'' have to run both latex and dvipdf to get a new version of the PDF file to view.  That is to say, a typical command history might be:
 +
<source lang="text">
 +
emacs lab1.tex &
 +
latex lab1.tex
 +
dvipdf lab1.dvi
 +
evince lab1.pdf &
 +
latex lab1.tex
 +
dvipdf lab1.dvi
 +
latex lab1.tex
 +
dvipdf lab1.dvi
 +
latex lab1.tex
 +
dvipdf lab1.dvi
 +
latex lab1.tex
 +
dvipdf lab1.dvi
 +
latex lab1.tex
 +
dvipdf lab1.dvi
 +
</source>
 +
 
===What do I do if LaTeX just sits there?===
 
===What do I do if LaTeX just sits there?===
Hitting CTRL-C, then x and return, will always get out of LaTeX regardless of the error  
+
If LaTeX hits an error, hit x and return for almost all errors (CTRL-D if it is a file missing error) to get out of LaTeX, then search above for the error, its location, and its probably cause.
 +
-->
 
===What did I do wrong?===
 
===What did I do wrong?===
 
Generally, LaTeX will try to tell you - look closely at the error message LaTeX gives you  
 
Generally, LaTeX will try to tell you - look closely at the error message LaTeX gives you  
Line 38: Line 143:
 
To continue: "I have checked it thousands of time and it looks good to me!"
 
To continue: "I have checked it thousands of time and it looks good to me!"
 
Make sure there are no blank lines within the environment. For some reason align hates those. The following, for example, causes problems:
 
Make sure there are no blank lines within the environment. For some reason align hates those. The following, for example, causes problems:
<pre>
+
<source lang="latex">
 
\begin{align}
 
\begin{align}
 
a\\
 
a\\
Line 44: Line 149:
 
b
 
b
 
\end{align}  
 
\end{align}  
</pre>
+
</source>
 
Also - it may be in a line above the end of the align environment. You can use % in front of a line of LaTeX code to turn that whole line into a comment - doing that, you can find which line is having a bad day and correct it.
 
Also - it may be in a line above the end of the align environment. You can use % in front of a line of LaTeX code to turn that whole line into a comment - doing that, you can find which line is having a bad day and correct it.
 +
 
===My \pagebreak doesn't...page...break  Why?===
 
===My \pagebreak doesn't...page...break  Why?===
Make sure there is ablank line after the \pagebreak command; that is:
+
Make sure there is a blank line after the \pagebreak command; that is:
<pre>
+
<source lang="latex">
 
blah
 
blah
 
\pagebreak
 
\pagebreak
  
 
more blah
 
more blah
</pre>
+
</source>
  
 
===How can I double space?===
 
===How can I double space?===
Basically, include the following two lines between the \documentclass and the \begin{document}<ref name=MIT>[http://web.mit.edu/answers/latex/formatting/latex_spacing.html How to change the SPACING inside documents (DOUBLE SPACING)] - from MIT</ref>:
+
Basically, include the following two lines between the \documentclass and the \begin{document}<ref name=MIT>[http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907092 How can I change the spacing in my LaTeX document?] - from MIT</ref>:
<pre>
+
<source lang="latex">
\usepackage{spacing}
+
\usepackage{setspace}
 
\setstretch{2.0}
 
\setstretch{2.0}
</pre>
+
</source>
 +
The MIT page has more options, including adding different spacing to sections of a document.
 +
 
 +
===How do I get a $ Symbol===
 +
For the characters that LaTeX uses as code ($ and { or }) you need to issue the command to print those - in other words, \\$ \{ and \} are the commands to print those individual characters.  For example, the code:
 +
<source lang="latex">
 +
\$\{10,000\}
 +
</source>
 +
will produce
 +
<math>
 +
\$\{10,000\}
 +
</math>
 +
 
 +
==Questions==
 +
{{Questions}}
 +
 
 +
==External Links==
 +
*[http://meta.wikimedia.org/wiki/Help:Displaying_a_formula Displaying a formula] on the Meta-Wiki
 +
*[http://en.wikibooks.org/wiki/Programming:LaTeX Wikibook on LaTeX] - a wiki devoted to LaTeX!  ''All kinds'' of good stuff here.
 +
*[[wikipedia:LaTeX|LaTeX]] on Wikipedia - includes several tutorials and references
 +
*Tobias Oetiker's "[https://tobi.oetiker.ch/lshort/lshort-letter.pdf  The Not So Short Introduction to LaTeX2e]" - great guide for beginning (and not so beginning) users.
 +
*Andrew Roberts' [http://www.andy-roberts.net/writing/latex "Getting to grips with LaTeX"] tutorial
 +
*The Comprehensive LaTeX Symbol List, Scott Pakin ([http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-letter.pdf PDF], over 100 pages! from 1/19/2017
 +
** [[http://www.ams.org/publications/authors/tex/amslatex AMS-LaTeX]] page
 +
*A more "visual" version of LaTeX:  [http://www.lyx.org LyX].
 +
*[http://www.tug.org/texshowcase/ LaTeX Showcase]
 +
*[http://www.tug.org/mactex/ MacTeX]- LaTeX for Macintosh Users with OS 10.5 or higher|
 +
*[https://www.tug.org/texlive/ TeX Live]
  
==Notes==
+
== References ==
<div class="references-small" style="-moz-column-count:2; column-count:2;">
+
<references />
<references /></div>
 
  
 
[[Category:Software]]
 
[[Category:Software]]
[[Category:Computer Stuff]]
+
[[Category:ECE 280]]
 +
[[Category:ECE 382]]
 +
[[Category:EGR 103]]
 +
[[Category:EGR 224]]
 +
[[Category:ME 344]]
 +
 
 +
[[Category:Semester Update]]

Latest revision as of 20:08, 13 September 2022

LaTeX
Document Preparation System
LaTeX logo.png
Version pdfTeXk 3.141592-1.40.3
Download On Unix
Web Page \(LaTeX\) Project
Pundit Updated 8/26/2019


LaTeX is a document preparation system written by Don Knuth (TeX) and extended by Leslie Lamport. It is a powerful, and free, way to generate professional, dynamic documents.

LaTeX on Pratt Pundit

The Basics

Pratt Pundit can process most basic \(\LaTeX\) structures by using \( and \) or math tags around \(\LaTeX\) code. For example,

\(q(t)=q(t_0)+\int_{t_0}^ti(\tau)~d\tau\)

can be created using

<center>
\(q(t)=q(t_0)+\int_{t_0}^ti(\tau)~d\tau\)
</center>

Equations can also be inline - for instance, \(c^2=a^2+b^2-2ab\cos(\theta)\) is an equation. The code for that is:

Equations can also be inline - for instance,  \(c^2=a^2+b^2-2ab\cos(\theta)\) is an equation.

Equation Lists

For multiple equations one after the other, use the \begin{align} environment. This will allow you to line equations up by placing an ampersand just before the symbol on each line you want as the alignment character. Use \\ to go to the next equation. For example,

<center>\(
\begin{align}
q(t)&=q(t_0)+\int_{t_0}^ti(\tau)~d\tau\\
a&=\left(\frac{dv}{dt}\right)
\end{align}
\)</center>

produces:

\( \begin{align} q(t)&=q(t_0)+\int_{t_0}^ti(\tau)~d\tau\\ a&=\left(\frac{dv}{dt}\right) \end{align} \)

You can also have multiple equations in the same row:

<center>\(
\begin{align}
L_1&=10~\mbox{mH} & R_1&=15~\mbox{k}\Omega & C_1&=22~\mu\mbox{F}\\
L_2&=18~\mbox{mH} & R_2&=22~\mbox{k}\Omega & C_2&=17~\mu\mbox{F}
\end{align}
\)</center>

produces:

\( \begin{align} L_1&=10~\mbox{mH} & R_1&=15~\mbox{k}\Omega & C_1&=22~\mu\mbox{F}\\ L_2&=18~\mbox{mH} & R_2&=22~\mbox{k}\Omega & C_2&=17~\mu\mbox{F} \end{align} \)

Arrays

Arrays work perfectly well in Pundit - as long as you don't try to stretch them:

\( \begin{array}{|c|c|c|}\hline \mbox{Singularity Function} & \mbox{Name} & \mbox{Alternate Symbol} \\ \hline \hline <t-a>^0 & \mbox{unit step function} & u(t) \\ \hline <t-a>^1 & \mbox{unit ramp function} & r(t)=t~u(t) \\ \hline \frac{1}{2}<t-a>^2 & \mbox{unit parabola function} & p(t)=\frac{1}{2}t^2~u(t) \\ \hline \end{array} \)

Known Issues

  • RESOLVED: LaTeX on Pundit didn't know "unnumbered" versions of things, but know it does - behold!
<center>\(
\begin{align*}
e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!}
\end{align*}
\)</center>

will cause:

\( \begin{align*} e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!} \end{align*} \)

which is correct! Note that using the unstarred version produces:

<center>\(
\begin{align}
e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!}
\end{align}
\)</center>

to get:

\( \begin{align} e^x&=\sum_{k=0}^{\infty}\frac{x^k}{k!} \end{align} \)
  • LaTeX on Pundit does not process changes to the \arraystretch variable - so arrays cannot be stretched or contracted.

FAQ

What did I do wrong?

Generally, LaTeX will try to tell you - look closely at the error message LaTeX gives you

What is Underfull hbox -10000?

It's a warning that something is a bit thin - generally a table or a figure. Don't worry about these at all.

Why does LaTeX think my align or align* environment is messed up?

To continue: "I have checked it thousands of time and it looks good to me!" Make sure there are no blank lines within the environment. For some reason align hates those. The following, for example, causes problems:

\begin{align}
a\\

b
\end{align}

Also - it may be in a line above the end of the align environment. You can use % in front of a line of LaTeX code to turn that whole line into a comment - doing that, you can find which line is having a bad day and correct it.

My \pagebreak doesn't...page...break Why?

Make sure there is a blank line after the \pagebreak command; that is:

blah
\pagebreak

more blah

How can I double space?

Basically, include the following two lines between the \documentclass and the \begin{document}[1]:

\usepackage{setspace}
\setstretch{2.0}

The MIT page has more options, including adding different spacing to sections of a document.

How do I get a $ Symbol

For the characters that LaTeX uses as code ($ and { or }) you need to issue the command to print those - in other words, \\$ \{ and \} are the commands to print those individual characters. For example, the code:

\$\{10,000\}

will produce \( \$\{10,000\} \)

Questions

Post your questions by editing the discussion page of this article. Edit the page, then scroll to the bottom and add a question by putting in the characters *{{Q}}, followed by your question and finally your signature (with four tildes, i.e. ~~~~). Using the {{Q}} will automatically put the page in the category of pages with questions - other editors hoping to help out can then go to that category page to see where the questions are. See the page for Template:Q for details and examples.

External Links

References