Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jeremy Ruston, Copyright © 2007-2011 UnaMesa Association
It is often useful in mathematics to produce a well formatted set of theorems with proofs. The [[AMS LaTeX|http://www.stat.umn.edu/~charlie/amslatex.html]] Style is useful here. Also, there other formatting advantages using [[AMS LaTeX|http://www.stat.umn.edu/~charlie/amslatex.html]].
One adds to the preamble the following:
{{{
\usepackage{amsmath,amsthm}
\newtheorem{proposition}{Proposition}
\newtheorem{theorem}{Theorem}
}}}
These lines call the AMS packages and define the form for Proposition and Theroem. Then one can enter a Theorem as
{{{
\begin{theorem}
If $f$ is continuous on $[a,b],$ then,
\begin{equation}
\int_a^b f(x)\, dx = F(b)-F(a)
\end{equation}
where $F$ is any antiderivative of $f$; i.e.,
$\frac{dF}{dx}=f(x)$.
\end{theorem}
}}}
One can bypass the AMS Style by defining the theorem and other environments by entering the folowing in the preamble:
{{{
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newcommand{\qed}{\nobreak \ifvmode \relax \else
\ifdim\lastskip<1.5em \hskip-\lastskip
\hskip1.5em plus0em minus0.5em \fi \nobreak
\vrule height0.75em width0.5em depth0.25em\fi}
}}}
Then one can enter the theorem as
{{{
\begin{theorem}
\emph{(Lagrange's Theorem)}
\label{Lagrange}
Let $G$ be a finite group, and let $H$ be a subgroup
of $G$. Then the order of $H$ divides the order of $G$.
\end{theorem}
}}}
All papers should have an abstract. The abstract should be short and provide a clear summary of what the reader will find out in your paper. It should state the problem and any major conlcusions or results.
This paragraph is enetered in the abstract command after the maketitle command. It takes the form
{{{
\abstract{ Enter your abstract here.}
}}}
The inserted abstract with the rest of your code isshown below.
{{{
\documentclass{article}
\title{This is My First Article}
\author{Your Name}
\date{ }
\begin{document}
\maketitle
\abstract{ Enter your abstract here.}
\end{document}
}}}
Next: [[Sectioning]]
'' Advanced Editing''
*[[Tables]]
*[[Figures]]
*[[Bibliography]]
*[[AMS Style]] - Useful for theorem environments.
*[[LaTeX Slides]], [[Prosper]] or [[Prosper2]], and [[Beamer]] or [[Beamer2]]* .
*[[Conversions]]
You can test your expressions using [[Online LaTeX Viewers]] or [[Live Previews]].
*Note - In MAT 495 we use [[Beamer]].
**(See also [[Beamer2]] and the [[Beamer Template|http://people.uncw.edu/hermanr/mat495//index.html#BeamerTemplate]] at the course site.)
**Read the [[Intro to Beamer|beamerIntro.pdf]].
Another LaTeX presentation style used by professionals is Beamer. This style provides presentations that might be considered a little slicker and look less like ~PowerPoint than some of the [[Prosper]] styles. However, some find it takes a little more effort to learn some of the fancier features. It is really not too difficult as you can see from the examples in [[Beamer2]].
!Beamer Websites
*[[Beamer LaTeX Class|https://bitbucket.org/rivanvx/beamer/wiki/Home]]
*[[Beamer 3.0 Slides|http://faq.ktug.or.kr/wiki/uploads/beamer_guide.pdf]]
*[[Beamer by Example|http://iacweb.ethz.ch/en/various/Mittelbau/download/latex_beamer.pdf]]
*[[Presentations in LaTeX - Introduction to the beamer class|http://www.google.com/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=7&ved=0CE4QFjAG&url=http%3A%2F%2Fwww.nyu.edu%2Fprojects%2Fpoliticsdatalab%2Flatex%2Fbeamer_nyu.pdf&ei=InUnUviGN_el4AOCnYHwCQ&usg=AFQjCNGtHnGH4U6k4vMVp_4b2-FoPOq8JA&[[x|sig2=KcSgAxBBgzkAKvZDvnZ5kw]]
*[[Steve Wicker's slides from Wake Forest|http://www.wfu.edu/~wickersg/latex/beamer/beamer.pdf]]
[[Beamer Themes|ftp://ftp.chinatex.org/TeXDoc/Beamer/Guide/Beamer_Themes.pdf]] - classifies themes and schemes
!Examples
*[[Dr. Herman's Basic Beamer|http://people.uncw.edu/hermanr/mat495/index.html#BeamerTemplate]]
*[[Simple Examples|http://www.informatik.uni-freiburg.de/~frank/ENG/latex-course/latex-course-3/latex-course-3_en.html]]
*[[Example with Instructions|http://math.arizona.edu/~swig/documentation/powerwhat/beamer-example.pdf]] with [[Source code|http://math.arizona.edu/~swig/documentation/powerwhat/]]
*[[TU/e Example|http://www.win.tue.nl/latex/documentation/tuebeamer/]] and [[PDF|http://www.win.tue.nl/latex/documentation/tuebeamer/tueslides.pdf]]- Beware of movie pages!
*Beamer Themes: [[1|http://mike.depalatis.net/beamerthemes/]], [[2|http://www.poirrier.be/~jean-etienne/info/latexbeamer/]], [[3|http://mike.depalatis.net/beamerthemes/]]
Aaron Oaks' [[Beamer Presentations|http://latex.berkeley.edu/f09/homeworks/week9/beamer_beamer.pdf]]
Here is an example for doing a presentation in [[Beamer]]. The related files are:
* PDF file [[beamerex2.pdf|beamerex2.pdf]]
* LaTeX File [[beamerex2.tex|beamerex2.tex]]
* Image files
**[[sine1.eps|sine1.eps]]
**[[sine2.eps|sine2.eps]]
**[[sine3.eps|sine3.eps]]
**[[sine4.eps|sine4.eps]]
**[[sine5.eps|sine5.eps]]
**[[myplot.eps|myplot.eps]]
A similar example in [[Prosper]] is in [[Prosper2]].
!More Examples
*Another example: [[beamerex.pdf|beamerex.pdf]] , [[beamerex.tex|beamerex.tex]]
*Example with equation overlays, two-columns for ~Figure-Text Combination, Example Blocks
**[[BeamerExample.pdf|BeamerExample.pdf]],
**[[BeamerExample.tex|BeamerExample.tex]]
**[[Thinker figure|thinker.jpg]]
!Change Background
One can add a background image by wither adding the following to the preamble
{{{
\usebackgroundtemplate{
\includegraphics[width=\paperwidth,height=\paperheight]{my_image}
}
}}}
To change one frame, create a block and set an image as the background of the block.
{{{
{
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{my_image}}
\begin{frame}{My new frame}
\begin{itemize}
\item 1
\item 2
\end{itemize}
\end{frame}
}
}}}
Of course, one could [[Create Your Own Beamer Theme|http://www.r-bloggers.com/create-your-own-beamer-template/]].
There are several ways to produce a bibliography. One is shown below.
{{{
\begin{thebibliography}{9}
\bibitem{KarpMas1} Karpman V I and Maslov E M 1977 A Perturbation Theory for the
Korteweg-deVries Equation {\it Phys. Lett.} {\bf 60A} p 307-308.
\bibitem{KaupNew} Kaup D J and Newell A C 1978 Solitons as Particles, Oscillators, and
in Slowly Changing Media: A Singular Perturbation Theory {\it
Proc. Roy. Soc. Lond.} {\bf A361}) p 413-446.
\end{thebibliography}
}}}
You can cite the works in the body of the paper by using the reference label:
{{{
\cite{KarpMas1,KaupNew}
}}}
The style used should be an accepted journal style determined in consultation with your thesis advisor. For style, bibliography, etc see
** [[AMS Handbook|http://www.ams.org/publications/authors/tex/author-handbook]]
**[[MAA|http://www.maa.org/publications/periodicals/american-mathematical-monthly]]
**[[Math Teacher Style|http://math.illinoisstate.edu/day/courses/old/223/citations.html]]
**[[NCTM Publications|http://www.nctm.org/publications/content.aspx?id=558]]
There are two types of citations. First, one can reference an equation, figure, table, section, etc. In this case you provide a label in the numbered equation, figure, etc.
{{{
\label{mylabel}
}}} Each entry (mylabel) needs to be unique.Then you can refer to the item using \ref{mylabel}, such as
{{{
In Equation (\ref{mylabel}) ...
}}}
Another type of citation is a bibliographic citation. First set up a bibliography at the end of your paper. For example
{{{
\begin{thebibliography}{99}
\bibitem{BH} D. Boneh and J. Horwitz, `` Generating a Product of Three Primes With an Unknown Factorization,'' unpublished manuscript.
\bibitem{SW} S. Wagstaff, Jr., ``Cryptanalysis of Number Theoretic Ciphers,'' Chapman and Hall/ CRC, pp.221-288. 2003.
\bibitem{MB} S. Miller and R. Takloo-Bighash, ``An invitation to Modern Number Theory,'' Princeton University, pp. 4-20. 2006.
\bibitem{MS} M. R. Schroeder, ``Number Theory in Science and Communication,'' Springer-Verlag, pp.110-139. 1984.
\bibitem{BS}E. Bach and J. Shallit, ``Algorithmic Number Theory,'' The MIT Press, pp.101-120, 155-157. 1997.
\bibitem{CMR} C. Cid, S. Murphy and M. Robshaw, ``Algebraic Aspects of the Advanced Encryption Standard,'' Springer, pp.5-45. 2006.
\end{thebibliography}
}}}
Now you can refer to one of the papers in your paper.
{{{
In 2003 Wagstaff \cite{SW} said ...
}}}
While referring to referencing and citation, we also mention that you can add footnotes. For example,
{{{
Just insert the footnote\footnote{This is an example of a footnote.} where you want it.
}}}
<<tabs tabsClass
Layout "Layout Templates" SystemLayout
System "System Tiddlers" SystemTiddlers
Style "StyleSheets" StyleSheets
"Side Bar" "Side Bar Elements" SystemSideBars
Shadows "Hidden System Pages" ShadowPages
>>
This page is a slightly modied version of [[Jack Parke's configuration|http://jackparke.googlepages.com/jtw.html#Config]]. Another one is at [[Julian Knight's site|http://knighjm.googlepages.com/knightnet-default-tw.html#Configuration]]. You can view the code. You will need to create several new tiddlers and add the corresponding code: SystemLayout, SystemTiddlers, StyleSheets, SystemSideBars,
*From Maple to LaTeX
** [[by H. Boas|http://www.math.tamu.edu/~Harold.Boas/courses/math696/converting-Maple-code-into-LaTeX.html]]
*From Word to LaTeX
**[[TexSoftware| http://www.math.pku.edu.cn/teachers/dengmh/TexSoftware/word2tex/]]
**[[Word2TeX|http://word2tex.com/]] - $45 - converts equations and pictures!
*Putting LaTeX on the Web
** [[by H. Boas|http://www.math.tamu.edu/~Harold.Boas/courses/math696/putting-LaTeX-on-the-Web.html]]
*[[Converters between LaTeX and PC Wordprocessors|http://www.kfa-juelich.de/isr/1/texconv/texcnv.html]]
*[[LaTeX
to PDF|http://ciips.ee.uwa.edu.au/~chandra/LaTeX2PDF/LaTeX2PDF.html]]
*[[Word2Tex|http://www.chikrii.com/products/tex2word/dl/]]
*[[Open Office to LaTeX|http://www.hj-gym.dk/~hj/writer2latex/]]
<html><iframe src="http://www.emerson.emory.edu/services/latex/latex_toc.html" style="width:100%;height:400px"></iframe></html>
{{{http://www.emerson.emory.edu/services/latex/latex_toc.html}}}
<html><iframe src="GeneralLaTeXExample.txt" style="width:100%;height:400px"></iframe></html>
You may copy and past this example into your editor or download it from [[here|http://people.uncw.edu/hermanr/LaTeX/GeneralLaTeXExample.tex]]. {{{http://people.uncw.edu/hermanr/LaTeX/GeneralLaTeXExample.tex}}}
One of the challenges to writing a paper in LaTeX is the insertion of figures into the document. It is easier to create graphics these days and even putting them into your documents. However, placing them exactly where you want them is sometimes a challenge. The other challenge is getting figures. If you have JPG files, then put the figure in the same folder as the main ~LaTeX file or a subfolder and insert it using
{{{
\begin{figure}
\includegraphics[width=2in]{thinker.jpg}
\caption{The Thinker, by Rodin, in Kansas City.}
\label{fig:thinker}
\end{figure}
}}}
You can use JPG images, PNG images, PDF files, etc. Some of the old instructions below might apply. See below for information on creating images. You might look into [[Inkscape|http://www.inkscape.org/]], a vector graphics editor which can produce eps graphics, [[GIMP|http://www.gimp.org/]], an Open Source Image Editor, or [[tikz|http://www.texample.net/tikz/]], a package for generating LaTeX images on the fly.
!Convert eps figures to pdf
Many of you are using ~PDFLaTeX. In the past one could not use EPS graphics. However, you can use the epstopdf package to convert eps files on the fly to pdf files. In the preamble enter
{{{
\usepackage{graphicx, epstopdf}
}}}
Then, call up the file (say thinker.eps) using
{{{ \includegraphics[width=2in]{thinker}
}}}
Notice that the eps extension is missing. On the first pass of ~PDFLaTeX the file thinker-eps-converted-to.pdf is created. The next pass will see this file and load it as the image. If the eps file is changed, the pdf file will be updated automatically.
!Older Comments - some of this is now outdated
A typical format is to use encapsulated postscript (EPS). The document is then compiled into a postscript document (PS) using dvips and may then be sent to PDF. Using Matalb, one can use convertToEPS.m to convert many file formats to EPS format. See Wkipedia for information about [[Graphics file formats|http://en.wikipedia.org/wiki/Graphics_file_format]]. Also, you can use Ghostview, which comes with ~MikTeX, to view EPS and PS files.
Other graphics, such as JPG or JPEG, can be used but one needs to process the LaTeX file using pdflatex. The images will not show in the DVI file. There are also other ways to insert graphics using the PSTRICKS package.
!Assorted Links on Graphics
*[[Including graphics in a LaTeX document|http://amath.colorado.edu/documentation/LaTeX/reference/figures.html]]
*[[LaTeX Tricks for Figures|http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/LatexTips.html]]
*[[PSTricks Examples|http://tug.org/PSTricks/main.cgi?file=examples]]
!Creating and Editing Figures
*[[convertToEPS.m|http://www.cs.cmu.edu/~jkubica/code/matlabToEPS.html]] - Convert images to eps format in Matlab
*[[Online Converter|http://www.tlhiv.org/rast2vec/]] JPEG/PNG to EPS/PDF
*[[GIMP|http://www.gimp.org/]] - Open Source Image Editor
*[[LaTexDraw Project|http://latexdraw.sourceforge.net/]] - Free PSTricks drawing tool
*[[Dia|http://live.gnome.org/Dia]] Diagram creation program
*[[Inkscape|http://www.inkscape.org/]] Vector graphics editor
*[[ArtRage|http://www.ambientdesign.com/artrage.html]] Painting program.
*[[OpenDX|http://opendx.org/]], [[MayaVi|http://mayavi.sourceforge.net/]] Data Visualization tools
*[[Blender|http://www.blender.org/]] 3D content creation
*[[PSTricks Users Guide|http://www.tex.uniyar.ac.ru/doc/pst_ug.pdf]]
*[[Postscript file conversions|http://mintaka.sdsu.edu/GF/bibliog/latex/PSconv.html]]
*[[AutoTrace|http://autotrace.sourceforge.net/]] and [[Potrace|http://potrace.sourceforge.net/]] Convert bitmap to vector graphics
*Positioning figures - [[Afterpage and centering|afterpage.txt]]
!!tikz and ~PGFplot
You can generate images on the fly using tikz package. First, load the package
{{{
\usepackage{tikz}
}}}
Then insert in figure environment:
{{{
\begin{figure}
\begin{center}
\begin{tikzpicture}
\draw (0,0) -- (0,2) -- (2,0)-- (0,0);
\end{tikzpicture}
\caption{This is a triangle}
\label{myfig1}
\end{center}
\end{figure}
}}}
Check out more examples at [[http://www.texample.net/|http://www.texample.net/]]. Also, there are drawing interfaces -
*[[QTikz|http://www.hackenberger.at/blog/ktikz-editor-for-the-tikz-language/]]
*[[TikzEdt|http://www.tikzedt.org/]]
*[[TikZit|http://tikzit.sourceforge.net/]]
!!Sample files for inserting figures - based on older methods
*EPS - compile with dvi2ps and ps2pdf
** download [[signals.eps|eps/signals.eps]], [[EpsDemo.tex|eps/EpsDemo.tex]]
** results [[EpsDemo.dvi|eps/EpsDemo.dvi]], [[EpsDemo.pdf|eps/EpsDemo.pdf]]
*JPEG - compile using pdflatex
** download [[signals.jpg|jpg/signals.jpg]], [[JpgDemo.tex|jpg/JpgDemo.tex]]
** download [[JpgDemo.pdf|jpg/JpgDemo.pdf]]
*PNG - compile using pdflatex
** download [[signals.png|jpg/signals.png]], [[PngDemo.tex|jpg/PngDemo.tex]]
** download [[PngDemo.pdf|jpg/PngDemo.pdf]]
*PDF - compile using pdflatex
** download [[signals.pdf|jpg/signals.pdf]], [[PdfDemo.tex|jpg/PdfDemo.tex]]
** download [[PdfDemo.pdf|jpg/PdfDemo.pdf]]
*BMP - only with DVI output
** download [[graph01.bmp|Graphix/graph01.bmp]], [[graphdemo.tex|Graphix/GraphDemo.tex]]
** results [[graphdemo.dvi|Graphix/GraphDemo.dvi]], [[graphdemo.pdf|Graphix/graphjpg.pdf]]
*WMF - only with DVI output
** downloads [[graph01.wmf|Picins/graph01.wmf]], [[graph.tex|Picins/GRAPH.TEX]]
** results [[graph.dvi|Picins/GRAPH.dvi]], [[graph.pdf|Picins/graph2.pdf]]
** style file [[tfw2.sty|Picins/TFW2.STY]]
It is possible to have your document produce both PDF and DVI files with the image included. Take your EPS and save it as PDF or convert to JPEG. Then when calling up the image, give the filename without the extension. Here is an example.
* download [[signals.eps|eps/signals.eps]], [[EpsDemo.tex|eps/EpsPdfDemo.tex]]
* results [[EpsDemo.dvi|eps/EpsPdfDemo.dvi]], [[EpsDemo.pdf|eps/EpsPdfDemo.pdf]]
[[LaTeX Symbols]]
[[LaTeX Math Symbols]]
[[LaTeX Cheatsheet|http://www.stdout.org/~winston/latex/latexsheet.pdf]]
[[Beamer Cheat Sheet|https://www.cpt.univ-mrs.fr/~masson/latex/Beamer-appearance-cheat-sheet.pdf]]
!!External Links
[[Getting Started with LaTeX|http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Index.html]] - by David R Wilkins
[[Document Preparation with LaTeX|http://www.stat.berkeley.edu/users/spector/latex2e.pdf]]
[[The Not So Short Introduction to LaTeX2e|https://tobi.oetiker.ch/lshort/lshort.pdf]]
[[Essential LaTeX|http://tug.ctan.org/info/latex-essential/ess2e.pdf]]
!!LaTeX Sites
[[CTAN|http://www.ctan.org/]] - the Comprehensive TeX Archive Network
[[LaTeX Project site|http://www.latex-project.org/]]
[[All styles files available on CTAN|http://www-sop.inria.fr/miaou/latex/styles-eng.html]]
!Interesting Cheat Sheets
[[Quick LaTeX Guide|users.dickinson.edu/~richesod/latex/latexcheatsheet.pdf]]
[[CSC Cheat Sheet|http://www.tug.org/texshowcase/cheat.pdf]] from [[TeX Showcase|http://www.tug.org/texshowcase/]]
[[Beamer Cheat Sheet|http://www.cpt.univ-mrs.fr/~masson/latex/Beamer-appearance-cheat-sheet.pdf]]
[[MATLAB|http://web.mit.edu/18.06/www/MATLAB/matlab-cheatsheet.pdf]]
[[Maple|http://scipp.ucsc.edu/~haber/webpage/maple_cheatsheet.pdf]]
[[Mathematica|http://www.cheat-sheets.org/saved-copy/mathematica-cheat-sheet.pdf]]
[[Maxima|http://www.cheat-sheets.org/saved-copy/Maxima_tutorial.pdf]]
[[Integrals|http://tutorial.math.lamar.edu/pdf/Calculus_Cheat_Sheet_Integrals_Reduced.pdf]] from [[http://www.cheat-sheets.org|http://www.cheat-sheets.org/]]
[[Physics|http://www.cheat-sheets.org/saved-copy/32514-Physics-Equations.pdf]]
The files here were created to comply with the formatting suggested by the Honors College [See the [[Departmental Honors|https://uncw.edu/honors/academics/departmental-honors/departmental.html]] page]. There is a new format for the title page. See the [[Honors Resource|https://uncw.edu/honors/academics/departmental-honors/resources.html]] page. Also, margins should be one inch. If you intend to print and bind a copy for personal use the left margin should be 1 and ½ inches to allow for binding.
The files needed to compose a UNCW Honors Thesis are in the file [[HonorsThesis.zip|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/HonorsThesis.zip]]. There you will find the style file and the following LaTeX files:
# Sample Honors Thesis LaTeX files:
##[[Main Body|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/HonorsThesis.tex]].
##[[Chapter 1|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/chap1.tex]]
##[[Chapter 2|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/chap2.tex]]
##[[Bibliography|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/biblio.tex]]
##[[Appendix|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/appendix.tex]]
#Notes:
##For 1.5" left margin and 1.0" right margin set \oddsidemargin=.54in and \textwidth = 5.92in. For 1" margins, set \oddsidemargin=0in and \textwidth = 6.5in. See lines 35-37 in [[Main Body|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/HonorsThesis.tex]].
##For page numbering to upper right, see instructions on line 39.
##When adding Examining Committee, adjust the hspace to align right signatures under "Approved By."
##If a Liaison is assigned, uncomment lines 115, 117, and 119.
These files produce the PDF file: [[HonorsThesis.pdf|http://people.uncw.edu/hermanr/LaTeX/HonorsThesis/HonorsThesis.pdf]]. For more about LaTeX check out the rest of these pages and the [[Masters Theses]] section.
The latest revision of the Sample Honors Thesis was provided January2023.
<html><iframe src="http://www.giss.nasa.gov/tools/latex/ltx-2.html" style="width:100%;height:400px"></iframe></html>
{{{http://www.giss.nasa.gov/tools/latex/ltx-2.html}}}
<<importTiddlers inline>>
/***
''Import Tiddlers Plugin for TiddlyWiki version 1.2.x, 2.0 and 2.1beta''
^^author: Eric Shulman - ELS Design Studios
source: http://www.TiddlyTools.com/#ImportTiddlersPlugin
license: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^
When many people share and edit copies of the same TiddlyWiki document, the ability to quickly collect all these changes back into a single, updated document that can then be redistributed to the entire group is very important. It can also be very extremely helpful when moving your own tiddlers from document to document (e.g., when upgrading to the latest version of TiddlyWiki, or 'pre-loading' your favorite stylesheets into a new 'empty' TiddlyWiki document.)
This plugin lets you selectively combine tiddlers from any two TiddlyWiki documents. An interactive control panel lets you pick a document to import from, and then select which tiddlers to import, with prompting for skip, rename, merge or replace actions when importing tiddlers that match existing titles. Automatically add tags to imported tiddlers so they are easy to find later on. Generates a detailed report of import 'history' in ImportedTiddlers.
!!!!!Interactive interface
<<<
{{{<<importTiddlers>>}}}
creates "import tiddlers" link. click to show/hide import control panel
{{{<<importTiddlers inline>>}}}
creates import control panel directly in tiddler content
<<importTiddlers inline>>
Press ''[browse]'' to select a TiddlyWiki document file to import. You can also type in the path/filename or a remote document URL (starting with http://)and press ''[open]''. //Note: There may be some delay to permit the browser time to access and load the document before updating the listbox with the titles of all tiddlers that are available to be imported.//
Select one or more titles from the listbox (hold CTRL or SHIFT while clicking to add/remove the highlight from individual list items). You can press ''[select all]'' to quickly highlight all tiddler titles in the list. Use the ''[-]'', ''[+]'', or ''[=]'' links to adjust the listbox size so you can view more (or less) tiddler titles at one time. When you have chosen the tiddlers you want to import and entered any extra tags, press ''[import]'' to begin copying them to the current TiddlyWiki document.
''select: all, new, changes, or differences''
You can click on ''all'', ''new'', ''changes'', or ''differences'' to automatically select a subset of tiddlers from the list. This makes it very quick and easy to find and import just the updated tiddlers you are interested in:
>''"all"'' selects ALL tiddlers from the import source document, even if they have not been changed.
>''"new"'' selects only tiddlers that are found in the import source document, but do not yet exist in the destination document
>''"changes"'' selects only tiddlers that exist in both documents but that are newer in the source document
>''"differences"'' selects all new and existing tiddlers that are different from the destination document (even if destination tiddler is newer)
''Import Tagging:''
Tiddlers that have been imported can be automatically tagged, so they will be easier to find later on, after they have been added to your document. New tags are entered into the "add tags" input field, and then //added// to the existing tags for each tiddler as it is imported.
''Skip, Rename, Merge, or Replace:''
When importing a tiddler whose title is identical to one that already exists, the import process pauses and the tiddler title is displayed in an input field, along with four push buttons: ''[skip]'', ''[rename]'', ''[merge]'' and ''[replace]''.
To bypass importing this tiddler, press ''[skip]''. To import the tiddler with a different name (so that both the tiddlers will exist when the import is done), enter a new title in the input field and then press ''[rename]''. Press ''[merge]'' to combine the content from both tiddlers into a single tiddler. Press ''[replace]'' to overwrite the existing tiddler with the imported one, discarding the previous tiddler content.
//Note: if both the title ''and'' modification date/////time match, the imported tiddler is assumed to be identical to the existing one, and will be automatically skipped (i.e., not imported) without asking.//
''Import Report History''
When tiddlers are imported, a report is generated into ImportedTiddlers, indicating when the latest import was performed, the number of tiddlers successfully imported, from what location, and by whom. It also includes a list with the title, date and author of each tiddler that was imported.
When the import process is completed, the ImportedTiddlers report is automatically displayed for your review. If more tiddlers are subsequently imported, a new report is //added// to ImportedTiddlers, above the previous report (i.e., at the top of the tiddler), so that a reverse-chronological history of imports is maintained.
If a cumulative record is not desired, the ImportedTiddlers report may be deleted at any time. A new ImportedTiddlers report will be created the next time tiddlers are imported.
Note: You can prevent the ImportedTiddlers report from being generated for any given import activity by clearing the "create a report" checkbox before beginning the import processing.
<<<
!!!!!non-interactive 'load tiddlers' macro
<<<
Useful for automated installation/update of plugins and other tiddler content.
{{{<<loadTiddlers "label:load tiddlers from %0" http://www.tiddlytools.com/example.html confirm>>}}}
<<loadTiddlers "label:load tiddlers from %0" http://www.tiddlytools.com/example.html confirm>>
Syntax:
{{{<<loadTiddlers label:text prompt:text filter source quiet confirm>>}}}
''label:text'' and ''prompt:text''
>defines link text and tooltip (prompt) that can be clicked to trigger the load tiddler processing. If a label is NOT provided, then no link is created and loadTiddlers() is executed whenever the containing tiddler is rendered.
''filter'' (optional) determines which tiddlers will be automatically selected for importing. Use one of the following keywords:
>''"all"'' retrieves ALL tiddlers from the import source document, even if they have not been changed.
>''"new"'' retrieves only tiddlers that are found in the import source document, but do not yet exist in the destination document
>''"changes"'' retrieves only tiddlers that exist in both documents for which the import source tiddler is newer than the existing tiddler
>''"updates"'' retrieves both ''new'' and ''changed'' tiddlers (this is the default action when none is specified)
>''"tiddler:~TiddlerName"'' retrieves only the specific tiddler named in the parameter.
>''"tag:text"'' retrieves only the tiddlers tagged with the indicated text.
''source'' (required) is the location of the imported document. It can be either a local document path/filename in whatever format your system requires, or a remote web location (starting with "http://" or "https://")
>use the keyword ''ask'' to prompt for a source location whenever the macro is invoked
''"quiet"'' (optional)
>supresses all status message during the import processing (e.g., "opening local file...", "found NN tiddlers..." etc). Note that if ANY tiddlers are actualy imported, a final information message will still be displayed (along with the ImportedTiddlers report), even when 'quiet' is specified. This ensures that changes to your document cannot occur without any visible indication at all.
''"confirm"'' (optional)
>adds interactive confirmation. A browser message box (OK/Cancel) is displayed for each tiddler that will be imported, so that you can manually bypass any tiddlers that you do not want to import.
<<<
!!!!!Installation
<<<
copy/paste the following tiddlers into your document:
''ImportTiddlersPlugin'' (tagged with <<tag systemConfig>>)
create/edit ''SideBarOptions'': (sidebar menu items)
^^Add "< < ImportTiddlers > >" macro^^
''Quick Installation Tip #1:''
If you are using an unmodified version of TiddlyWiki (core release version <<version>>), you can get a new, empty TiddlyWiki with the Import Tiddlers plugin pre-installed (''[[download from here|TW+ImportExport.html]]''), and then simply import all your content from your old document into this new, empty document.
<<<
!!!!!Revision History
<<<
''2006.08.16 [3.0.6]'' Use higher-level store.saveTiddler() instead of store.addTiddler() to avoid conflicts with ZW and other adaptations that hijack low-level tiddler handling. Also, in CreateImportPanel(), no longer register notify to "refresh listbox after every tiddler change" (left over from old 'auto-filtered' list handling). Thanks to Bob McElrath for report/solution.
''2006.07.29 [3.0.5]'' added noChangeMsg to loadTiddlers processing. if not 'quiet' mode, reports skipped tiddlers.
''2006.04.18 [3.0.4]'' in loadTiddlers.handler, fixed parsing of "prompt:" param. Also, corrected parameters mismatch in loadTiddlers() callback function definition (order of params was wrong, resulting in filters NOT being applied)
''2006.04.12 [3.0.3]'' moved many display messages to macro properties for easier L10N translations via 'lingo' definitions.
''2006.04.12 [3.0.2]'' additional refactoring of 'core candidate' code. Proposed API now defines "loadRemoteFile()" for XMLHttpRequest processing with built in fallback for handling local filesystem access, and readTiddlersFromHTML() to process the resulting source HTML content.
''2006.04.04 [3.0.1]'' in refreshImportList(), when using [by tags], tiddlers without tags are now included in a new "untagged" psuedo-tag list section
''2006.04.04 [3.0.0]'' Separate non-interactive {{{<<importTiddlers...>>}}} macro functionality for incorporation into TW2.1 core and renamed as {{{<<loadTiddlers>>}}} macro. New parameters for loadTiddlers: ''label:text'' and ''prompt:text'' for link creation, ''ask'' for filename/URL, ''tag:text'' for filtering, "confirm" for accept/reject of individual inbound tiddlers. Also, ImportedTiddlers report generator output has been simplified and "importReplace/importPublic" tags and associated "force" param (which were rarely, if ever, used) has been dropped.
''2006.03.30 [2.9.1]'' when extracting store area from remote URL, look for "</body>" instead of "</body>\n</html>" so it will match even if the "\n" is absent from the source.
''2006.03.30 [2.9.0]'' added optional 'force' macro param. When present, autoImportTiddlers() bypasses the checks for importPublic and importReplace. Based on a request from Tom Otvos.
''2006.03.28 [2.8.1]'' in loadImportFile(), added checks to see if 'netscape' and 'x.overrideMimeType()' are defined (IE does *not* define these values, so we bypass this code)
Also, when extracting store area from remote URL, explicitly look for "</body>\n</html>" to exclude any extra content that may have been added to the end of the file by hosting environments such as GeoCities. Thanks to Tom Otvos for finding these bugs and suggesting some fixes.
''2006.02.21 [2.8.0]'' added support for "tiddler:TiddlerName" filtering parameter in auto-import processing
''2006.02.21 [2.7.1]'' Clean up layout problems with IE. (Use tables for alignment instead of SPANs styled with float:left and float:right)
''2006.02.21 [2.7.0]'' Added "local file" and "web server" radio buttons for selecting dynamic import source controls in ImportPanel. Default file control is replaced with URL text input field when "web server" is selected. Default remote document URL is defined in SiteURL tiddler. Also, added option for prepending SiteProxy URL as prefix to remote URL to mask cross-domain document access (requires compatible server-side script)
''2006.02.17 [2.6.0]'' Removed "differences only" listbox display mode, replaced with selection filter 'presets': all/new/changes/differences. Also fixed initialization handling for "add new tags" so that checkbox state is correctly tracked when panel is first displayed.
''2006.02.16 [2.5.4]'' added checkbox options to control "import remote tags" and "keep existing tags" behavior, in addition to existing "add new tags" functionality.
''2006.02.14 [2.5.3]'' FF1501 corrected unintended global 't' (loop index) in importReport() and autoImportTiddlers()
''2006.02.10 [2.5.2]'' corrected unintended global variable in importReport().
''2006.02.05 [2.5.1]'' moved globals from window.* to config.macros.importTiddlers.* to avoid FireFox 1.5.0.1 crash bug when referencing globals
''2006.01.18 [2.5.0]'' added checkbox for "create a report". Default is to create/update the ImportedTiddlers report. Clear the checkbox to skip this step.
''2006.01.15 [2.4.1]'' added "importPublic" tag and inverted default so that auto sharing is NOT done unless tagged with importPublic
''2006.01.15 [2.4.0]'' Added support for tagging individual tiddlers with importSkip, importReplace, and/or importPrivate to control which tiddlers can be overwritten or shared with others when using auto-import macro syntax. Defaults are to SKIP overwriting existing tiddlers with imported tiddlers, and ALLOW your tiddlers to be auto-imported by others.
''2006.01.15 [2.3.2]'' Added "ask" parameter to confirm each tiddler before importing (for use with auto-importing)
''2006.01.15 [2.3.1]'' Strip TW core scripts from import source content and load just the storeArea into the hidden IFRAME. Makes loading more efficient by reducing the document size and by preventing the import document from executing its TW initialization (including plugins). Seems to resolve the "Found 0 tiddlers" problem. Also, when importing local documents, use convertUTF8ToUnicode() to convert the file contents so support international characters sets.
''2006.01.12 [2.3.0]'' Reorganized code to use callback function for loading import files to support event-driven I/O via an ASYNCHRONOUS XMLHttpRequest. Let's processing continue while waiting for remote hosts to respond to URL requests. Added non-interactive 'batch' macro mode, using parameters to specify which tiddlers to import, and from what document source. Improved error messages and diagnostics, plus an optional 'quiet' switch for batch mode to eliminate //most// feedback.
''2006.01.11 [2.2.0]'' Added "[by tags]" to list of tiddlers, based on code submitted by BradleyMeck
''2006.01.09 [2.1.1]'' When a URL is typed in, and then the "open" button is pressed, it generates both an onChange event for the file input and a click event for open button. This results in multiple XMLHttpRequest()'s which seem to jam things up quite a bit. I removed the onChange handling for file input field. To open a file (local or URL), you must now explicitly press the "open" button in the control panel.
''2006.01.08 [2.1.0]'' IMPORT FROM ANYWHERE!!! re-write getImportedTiddlers() logic to either read a local file (using local I/O), OR... read a remote file, using a combination of XML and an iframe to permit cross-domain reading of DOM elements. Adapted from example code and techniques courtesy of Jonny LeRoy.
''2006.01.06 [2.0.2]'' When refreshing list contents, fixed check for tiddlerExists() when "show differences only" is selected, so that imported tiddlers that don't exist in the current file will be recognized as differences and included in the list.
''2006.01.04 [2.0.1]'' When "show differences only" is NOT checked, import all tiddlers that have been selected even when they have a matching title and date.
''2005.12.27 [2.0.0]'' Update for TW2.0
Defer initial panel creation and only register a notification function when panel first is created
''2005.12.22 [1.3.1]'' tweak formatting in importReport() and add 'discard report' link to output
''2005.12.03 [1.3.0]'' Dynamically create/remove importPanel as needed to ensure only one instance of interface elements exists, even if there are multiple instances of macro embedding. Also, dynamically create/recreate importFrame each time an external TW document is loaded for importation (reduces DOM overhead and ensures a 'fresh' frame for each document)
''2005.11.29 [1.2.1]'' fixed formatting of 'detail info' in importReport()
''2005.11.11 [1.2.0]'' added 'inline' param to embed controls in a tiddler
''2005.11.09 [1.1.0]'' only load HTML and CSS the first time the macro handler is called. Allows for redundant placement of the macro without creating multiple instances of controls with the same ID's.
''2005.10.25 [1.0.5]'' fixed typo in importReport() that prevented reports from being generated
''2005.10.09 [1.0.4]'' combined documentation with plugin code instead of using separate tiddlers
''2005.08.05 [1.0.3]'' moved CSS and HTML definitions into plugin code instead of using separate tiddlers
''2005.07.27 [1.0.2]'' core update 1.2.29: custom overlayStyleSheet() replaced with new core setStylesheet()
''2005.07.23 [1.0.1]'' added parameter checks and corrected addNotification() usage
''2005.07.20 [1.0.0]'' Initial Release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
// // ''MACRO DEFINITION''
//{{{
// Version
version.extensions.importTiddlers = {major: 3, minor: 0, revision: 6, date: new Date(2006,8,16)};
// IE needs explicit global scoping for functions/vars called from browser events
window.onClickImportButton=onClickImportButton;
window.refreshImportList=refreshImportList;
// default cookie/option values
if (!config.options.chkImportReport) config.options.chkImportReport=true;
config.macros.importTiddlers = { };
config.macros.importTiddlers = {
label: "import tiddlers",
prompt: "Copy tiddlers from another document",
foundMsg: "Found %0 tiddlers in %1",
countMsg: "%0 tiddlers selected for import",
importedMsg: "Imported %0 of %1 tiddlers from %2",
src: "", // path/filename or URL of document to import (retrieved from SiteUrl tiddler)
proxy: "", // URL for remote proxy script (retrieved from SiteProxy tiddler)
useProxy: false, // use specific proxy script in front of remote URL
inbound: null, // hash-indexed array of tiddlers from other document
newTags: "", // text of tags added to imported tiddlers
addTags: true, // add new tags to imported tiddlers
listsize: 8, // # of lines to show in imported tiddler list
importTags: true, // include tags from remote source document when importing a tiddler
keepTags: true, // retain existing tags when replacing a tiddler
index: 0, // current processing index in import list
sort: "" // sort order for imported tiddler listbox
};
config.macros.importTiddlers.handler = function(place,macroName,params) {
if (!config.macros.loadTiddlers.handler)
{ alert("importTiddlers error: this plugin requires LoadTiddlersPlugin or TiddlyWiki 2.1+"); return; }
if (!params[0]) // LINK TO FLOATING PANEL
createTiddlyButton(place,this.label,this.prompt,onClickImportMenu);
else if (params[0]=="inline") {// // INLINE TIDDLER CONTENT
createImportPanel(place);
document.getElementById("importPanel").style.position="static";
document.getElementById("importPanel").style.display="block";
}
else config.macros.loadTiddlers.handler(place,macroName,params); // FALLBACK: PASS TO LOADTIDDLERS
}
//}}}
// // ''INTERFACE DEFINITION''
// // Handle link click to create/show/hide control panel
//{{{
function onClickImportMenu(e)
{
if (!e) var e = window.event;
var parent=resolveTarget(e).parentNode;
var panel = document.getElementById("importPanel");
if (panel==undefined || panel.parentNode!=parent)
panel=createImportPanel(parent);
var isOpen = panel.style.display=="block";
if(config.options.chkAnimate)
anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,"none"));
else
panel.style.display = isOpen ? "none" : "block" ;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
return(false);
}
//}}}
// // Create control panel: HTML, CSS
//{{{
function createImportPanel(place) {
var panel=document.getElementById("importPanel");
if (panel) { panel.parentNode.removeChild(panel); }
setStylesheet(config.macros.importTiddlers.css,"importTiddlers");
panel=createTiddlyElement(place,"span","importPanel",null,null)
panel.innerHTML=config.macros.importTiddlers.html;
refreshImportList();
var siteURL=store.getTiddlerText("SiteUrl"); if (!siteURL) siteURL="";
document.getElementById("importSourceURL").value=siteURL;
config.macros.importTiddlers.src=siteURL;
var siteProxy=store.getTiddlerText("SiteProxy"); if (!siteProxy) siteProxy="SiteProxy";
document.getElementById("importSiteProxy").value=siteProxy;
config.macros.importTiddlers.proxy=siteProxy;
return panel;
}
//}}}
// // CSS
//{{{
config.macros.importTiddlers.css = '\
#importPanel {\
display: none; position:absolute; z-index:11; width:35em; right:105%; top:3em;\
background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\
border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\
padding: 0.5em; margin:0em; -moz-border-radius:1em;\
}\
#importPanel a, #importPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\
#importPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\
#importPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\
#importPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\
#importPanel select { width:98%;margin:0px;font-size:8pt;line-height:110%;}\
#importPanel input { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\
#importPanel .box { border:1px solid black; padding:3px; margin-bottom:5px; background:#f8f8f8; -moz-border-radius:5px;}\
#importPanel .topline { border-top:2px solid black; padding-top:3px; margin-bottom:5px; }\
#importPanel .rad { width:auto; }\
#importPanel .chk { width:auto; margin:1px;border:0; }\
#importPanel .btn { width:auto; }\
#importPanel .btn1 { width:98%; }\
#importPanel .btn2 { width:48%; }\
#importPanel .btn3 { width:32%; }\
#importPanel .btn4 { width:24%; }\
#importPanel .btn5 { width:19%; }\
#importPanel .importButton { padding: 0em; margin: 0px; font-size:8pt; }\
#importPanel .importListButton { padding:0em 0.25em 0em 0.25em; color: #000000; display:inline }\
#importCollisionPanel { display:none; margin:0.5em 0em 0em 0em; }\
';
//}}}
// // HTML
//{{{
config.macros.importTiddlers.html = '\
<!-- source and report -->\
<table><tr><td align=left>\
import from\
<input type="radio" class="rad" name="importFrom" value="file" CHECKED\
onClick="document.getElementById(\'importLocalPanel\').style.display=this.checked?\'block\':\'none\';\
document.getElementById(\'importHTTPPanel\').style.display=!this.checked?\'block\':\'none\'"> local file\
<input type="radio" class="rad" name="importFrom" value="http"\
onClick="document.getElementById(\'importLocalPanel\').style.display=!this.checked?\'block\':\'none\';\
document.getElementById(\'importHTTPPanel\').style.display=this.checked?\'block\':\'none\'"> web server\
</td><td align=right>\
<input type=checkbox class="chk" id="chkImportReport" checked\
onClick="config.options[\'chkImportReport\']=this.checked;"> create a report\
</td></tr></table>\
<!-- import from local file -->\
<div id="importLocalPanel" style="display:block;margin-bottom:5px;margin-top:5px;padding-top:3px;border-top:1px solid #999">\
local document path/filename:<br>\
<input type="file" id="fileImportSource" size=57 style="width:100%"\
onKeyUp="config.macros.importTiddlers.src=this.value"\
onChange="config.macros.importTiddlers.src=this.value;">\
</div><!--panel-->\
\
<!-- import from http server -->\
<div id="importHTTPPanel" style="display:none;margin-bottom:5px;margin-top:5px;padding-top:3px;border-top:1px solid #999">\
<table><tr><td align=left>\
remote document URL:<br>\
</td><td align=right>\
<input type="checkbox" class="chk" id="importUseProxy"\
onClick="config.macros.importTiddlers.useProxy=this.checked;\
document.getElementById(\'importSiteProxy\').style.display=this.checked?\'block\':\'none\'"> use a proxy script\
</td></tr></table>\
<input type="text" id="importSiteProxy" style="display:none;margin-bottom:1px" onfocus="this.select()" value="SiteProxy"\
onKeyUp="config.macros.importTiddlers.proxy=this.value"\
onChange="config.macros.importTiddlers.proxy=this.value;">\
<input type="text" id="importSourceURL" onfocus="this.select()" value="SiteUrl"\
onKeyUp="config.macros.importTiddlers.src=this.value"\
onChange="config.macros.importTiddlers.src=this.value;">\
</div><!--panel-->\
\
<table><tr><td align=left>\
select:\
<a href="JavaScript:;" id="importSelectAll"\
onclick="onClickImportButton(this)" title="select all tiddlers">\
all </a>\
<a href="JavaScript:;" id="importSelectNew"\
onclick="onClickImportButton(this)" title="select tiddlers not already in destination document">\
added </a> \
<a href="JavaScript:;" id="importSelectChanges"\
onclick="onClickImportButton(this)" title="select tiddlers that have been updated in source document">\
changes </a> \
<a href="JavaScript:;" id="importSelectDifferences"\
onclick="onClickImportButton(this)" title="select tiddlers that have been added or are different from existing tiddlers">\
differences </a> \
<a href="JavaScript:;" id="importToggleFilter"\
onclick="onClickImportButton(this)" title="show/hide selection filter">\
filter </a> \
</td><td align=right>\
<a href="JavaScript:;" id="importListSmaller"\
onclick="onClickImportButton(this)" title="reduce list size">\
– </a>\
<a href="JavaScript:;" id="importListLarger"\
onclick="onClickImportButton(this)" title="increase list size">\
+ </a>\
<a href="JavaScript:;" id="importListMaximize"\
onclick="onClickImportButton(this)" title="maximize/restore list size">\
= </a>\
</td></tr></table>\
<select id="importList" size=8 multiple\
onchange="setTimeout(\'refreshImportList(\'+this.selectedIndex+\')\',1)">\
<!-- NOTE: delay refresh so list is updated AFTER onchange event is handled -->\
</select>\
<input type=checkbox class="chk" id="chkAddTags" checked\
onClick="config.macros.importTiddlers.addTags=this.checked;">add new tags \
<input type=checkbox class="chk" id="chkImportTags" checked\
onClick="config.macros.importTiddlers.importTags=this.checked;">import source tags \
<input type=checkbox class="chk" id="chkKeepTags" checked\
onClick="config.macros.importTiddlers.keepTags=this.checked;">keep existing tags<br>\
<input type=text id="txtNewTags" size=15 onKeyUp="config.macros.importTiddlers.newTags=this.value" autocomplete=off>\
<div align=center>\
<input type=button id="importOpen" class="importButton" style="width:32%" value="open"\
onclick="onClickImportButton(this)">\
<input type=button id="importStart" class="importButton" style="width:32%" value="import"\
onclick="onClickImportButton(this)">\
<input type=button id="importClose" class="importButton" style="width:32%" value="close"\
onclick="onClickImportButton(this)">\
</div>\
<div id="importCollisionPanel">\
tiddler already exists:\
<input type=text id="importNewTitle" size=15 autocomplete=off">\
<div align=center>\
<input type=button id="importSkip" class="importButton" style="width:23%" value="skip"\
onclick="onClickImportButton(this)">\
<input type=button id="importRename" class="importButton" style="width:23%" value="rename"\
onclick="onClickImportButton(this)">\
<input type=button id="importMerge" class="importButton" style="width:23%" value="merge"\
onclick="onClickImportButton(this)">\
<input type=button id="importReplace" class="importButton" style="width:23%" value="replace"\
onclick="onClickImportButton(this)">\
</div>\
</div>\
';
//}}}
// // Control interactions
//{{{
function onClickImportButton(which)
{
// DEBUG alert(which.id);
var theList = document.getElementById('importList');
if (!theList) return;
var thePanel = document.getElementById('importPanel');
var theCollisionPanel = document.getElementById('importCollisionPanel');
var theNewTitle = document.getElementById('importNewTitle');
var count=0;
switch (which.id)
{
case 'fileImportSource':
case 'importOpen': // load import source into hidden frame
importReport(); // if an import was in progress, generate a report
config.macros.importTiddlers.inbound=null; // clear the imported tiddler buffer
refreshImportList(); // reset/resize the listbox
if (config.macros.importTiddlers.src=="") break;
// Load document into hidden iframe so we can read it's DOM and fill the list
loadRemoteFile(config.macros.importTiddlers.src, function(src,txt) {
var tiddlers = readTiddlersFromHTML(txt);
var count=tiddlers?tiddlers.length:0;
displayMessage(config.macros.importTiddlers.foundMsg.format([count,src]));
config.macros.importTiddlers.inbound=tiddlers;
window.refreshImportList(0);
});
break;
case 'importSelectAll': // select all tiddler list items (i.e., not headings)
importReport(); // if an import was in progress, generate a report
for (var t=0,count=0; t < theList.options.length; t++) {
if (theList.options[t].value=="") continue;
theList.options[t].selected=true;
count++;
}
clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));
break;
case 'importSelectNew': // select tiddlers not in current document
importReport(); // if an import was in progress, generate a report
for (var t=0,count=0; t < theList.options.length; t++) {
theList.options[t].selected=false;
if (theList.options[t].value=="") continue;
theList.options[t].selected=!store.tiddlerExists(theList.options[t].value);
count+=theList.options[t].selected?1:0;
}
clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));
break;
case 'importSelectChanges': // select tiddlers that are updated from existing tiddlers
importReport(); // if an import was in progress, generate a report
for (var t=0,count=0; t < theList.options.length; t++) {
theList.options[t].selected=false;
if (theList.options[t].value==""||!store.tiddlerExists(theList.options[t].value)) continue;
for (var i=0; i<config.macros.importTiddlers.inbound.length; i++) // find matching inbound tiddler
{ var inbound=config.macros.importTiddlers.inbound[i]; if (inbound.title==theList.options[t].value) break; }
theList.options[t].selected=(inbound.modified-store.getTiddler(theList.options[t].value).modified>0); // updated tiddler
count+=theList.options[t].selected?1:0;
}
clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));
break;
case 'importSelectDifferences': // select tiddlers that are new or different from existing tiddlers
importReport(); // if an import was in progress, generate a report
for (var t=0,count=0; t < theList.options.length; t++) {
theList.options[t].selected=false;
if (theList.options[t].value=="") continue;
if (!store.tiddlerExists(theList.options[t].value)) { theList.options[t].selected=true; count++; continue; }
for (var i=0; i<config.macros.importTiddlers.inbound.length; i++) // find matching inbound tiddler
{ var inbound=config.macros.importTiddlers.inbound[i]; if (inbound.title==theList.options[t].value) break; }
theList.options[t].selected=(inbound.modified-store.getTiddler(theList.options[t].value).modified!=0); // changed tiddler
count+=theList.options[t].selected?1:0;
}
clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));
break;
case 'importToggleFilter': // show/hide filter
case 'importFilter': // apply filter
alert("coming soon!");
break;
case 'importStart': // initiate the import processing
importReport(); // if an import was in progress, generate a report
config.macros.importTiddlers.index=0;
config.macros.importTiddlers.index=importTiddlers(0);
importStopped();
break;
case 'importClose': // unload imported tiddlers or hide the import control panel
// if imported tiddlers not loaded, close the import control panel
if (!config.macros.importTiddlers.inbound) { thePanel.style.display='none'; break; }
importReport(); // if an import was in progress, generate a report
config.macros.importTiddlers.inbound=null; // clear the imported tiddler buffer
refreshImportList(); // reset/resize the listbox
break;
case 'importSkip': // don't import the tiddler
var theItem = theList.options[config.macros.importTiddlers.index];
for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)
if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;
var theImported = config.macros.importTiddlers.inbound[j];
theImported.status='skipped after asking'; // mark item as skipped
theCollisionPanel.style.display='none';
config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index+1); // resume with NEXT item
importStopped();
break;
case 'importRename': // change name of imported tiddler
var theItem = theList.options[config.macros.importTiddlers.index];
for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)
if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;
var theImported = config.macros.importTiddlers.inbound[j];
theImported.status = 'renamed from '+theImported.title; // mark item as renamed
theImported.set(theNewTitle.value,null,null,null,null); // change the tiddler title
theItem.value = theNewTitle.value; // change the listbox item text
theItem.text = theNewTitle.value; // change the listbox item text
theCollisionPanel.style.display='none';
config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with THIS item
importStopped();
break;
case 'importMerge': // join existing and imported tiddler content
var theItem = theList.options[config.macros.importTiddlers.index];
for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)
if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;
var theImported = config.macros.importTiddlers.inbound[j];
var theExisting = store.getTiddler(theItem.value);
var theText = theExisting.text+'\n----\n^^merged from: ';
theText +='[['+config.macros.importTiddlers.src+'#'+theItem.value+'|'+config.macros.importTiddlers.src+'#'+theItem.value+']]^^\n';
theText +='^^'+theImported.modified.toLocaleString()+' by '+theImported.modifier+'^^\n'+theImported.text;
var theDate = new Date();
var theTags = theExisting.getTags()+' '+theImported.getTags();
theImported.set(null,theText,null,theDate,theTags);
theImported.status = 'merged with '+theExisting.title; // mark item as merged
theImported.status += ' - '+theExisting.modified.formatString("MM/DD/YYYY 0hh:0mm:0ss");
theImported.status += ' by '+theExisting.modifier;
theCollisionPanel.style.display='none';
config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with this item
importStopped();
break;
case 'importReplace': // substitute imported tiddler for existing tiddler
var theItem = theList.options[config.macros.importTiddlers.index];
for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)
if (config.macros.importTiddlers.inbound[j].title==theItem.value) break;
var theImported = config.macros.importTiddlers.inbound[j];
var theExisting = store.getTiddler(theItem.value);
theImported.status = 'replaces '+theExisting.title; // mark item for replace
theImported.status += ' - '+theExisting.modified.formatString("MM/DD/YYYY 0hh:0mm:0ss");
theImported.status += ' by '+theExisting.modifier;
theCollisionPanel.style.display='none';
config.macros.importTiddlers.index=importTiddlers(config.macros.importTiddlers.index); // resume with THIS item
importStopped();
break;
case 'importListSmaller': // decrease current listbox size, minimum=5
if (theList.options.length==1) break;
theList.size-=(theList.size>5)?1:0;
config.macros.importTiddlers.listsize=theList.size;
break;
case 'importListLarger': // increase current listbox size, maximum=number of items in list
if (theList.options.length==1) break;
theList.size+=(theList.size<theList.options.length)?1:0;
config.macros.importTiddlers.listsize=theList.size;
break;
case 'importListMaximize': // toggle listbox size between current and maximum
if (theList.options.length==1) break;
theList.size=(theList.size==theList.options.length)?config.macros.importTiddlers.listsize:theList.options.length;
break;
}
}
//}}}
// // refresh listbox
//{{{
function refreshImportList(selectedIndex)
{
var theList = document.getElementById("importList");
if (!theList) return;
// if nothing to show, reset list content and size
if (!config.macros.importTiddlers.inbound)
{
while (theList.length > 0) { theList.options[0] = null; }
theList.options[0]=new Option('please open a document...',"",false,false);
theList.size=config.macros.importTiddlers.listsize;
return;
}
// get the sort order
if (!selectedIndex) selectedIndex=0;
if (selectedIndex==0) config.macros.importTiddlers.sort='title'; // heading
if (selectedIndex==1) config.macros.importTiddlers.sort='title';
if (selectedIndex==2) config.macros.importTiddlers.sort='modified';
if (selectedIndex==3) config.macros.importTiddlers.sort='tags';
if (selectedIndex>3) {
// display selected tiddler count
for (var t=0,count=0; t < theList.options.length; t++) count+=(theList.options[t].selected&&theList.options[t].value!="")?1:0;
clearMessage(); displayMessage(config.macros.importTiddlers.countMsg.format([count]));
return; // no refresh needed
}
// get the alphasorted list of tiddlers (optionally, filter out unchanged tiddlers)
var tiddlers=config.macros.importTiddlers.inbound;
tiddlers.sort(function (a,b) {if(a['title'] == b['title']) return(0); else return (a['title'] < b['title']) ? -1 : +1; });
// clear current list contents
while (theList.length > 0) { theList.options[0] = null; }
// add heading and control items to list
var i=0;
var indent=String.fromCharCode(160)+String.fromCharCode(160);
theList.options[i++]=new Option(tiddlers.length+' tiddler'+((tiddlers.length!=1)?'s are':' is')+' in the document',"",false,false);
theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="title" )?">":indent)+' [by title]',"",false,false);
theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="modified")?">":indent)+' [by date]',"",false,false);
theList.options[i++]=new Option(((config.macros.importTiddlers.sort=="tags")?">":indent)+' [by tags]',"",false,false);
// output the tiddler list
switch(config.macros.importTiddlers.sort)
{
case "title":
for(var t = 0; t < tiddlers.length; t++)
theList.options[i++] = new Option(tiddlers[t].title,tiddlers[t].title,false,false);
break;
case "modified":
// sort descending for newest date first
tiddlers.sort(function (a,b) {if(a['modified'] == b['modified']) return(0); else return (a['modified'] > b['modified']) ? -1 : +1; });
var lastSection = "";
for(var t = 0; t < tiddlers.length; t++) {
var tiddler = tiddlers[t];
var theSection = tiddler.modified.toLocaleDateString();
if (theSection != lastSection) {
theList.options[i++] = new Option(theSection,"",false,false);
lastSection = theSection;
}
theList.options[i++] = new Option(indent+indent+tiddler.title,tiddler.title,false,false);
}
break;
case "tags":
var theTitles = {}; // all tiddler titles, hash indexed by tag value
var theTags = new Array();
for(var t=0; t<tiddlers.length; t++) {
var title=tiddlers[t].title;
var tags=tiddlers[t].tags;
if (!tags || !tags.length) {
if (theTitles["untagged"]==undefined) { theTags.push("untagged"); theTitles["untagged"]=new Array(); }
theTitles["untagged"].push(title);
}
else for(var s=0; s<tags.length; s++) {
if (theTitles[tags[s]]==undefined) { theTags.push(tags[s]); theTitles[tags[s]]=new Array(); }
theTitles[tags[s]].push(title);
}
}
theTags.sort();
for(var tagindex=0; tagindex<theTags.length; tagindex++) {
var theTag=theTags[tagindex];
theList.options[i++]=new Option(theTag,"",false,false);
for(var t=0; t<theTitles[theTag].length; t++)
theList.options[i++]=new Option(indent+indent+theTitles[theTag][t],theTitles[theTag][t],false,false);
}
break;
}
theList.selectedIndex=selectedIndex; // select current control item
if (theList.size<config.macros.importTiddlers.listsize) theList.size=config.macros.importTiddlers.listsize;
if (theList.size>theList.options.length) theList.size=theList.options.length;
}
//}}}
// // re-entrant processing for handling import with interactive collision prompting
//{{{
function importTiddlers(startIndex)
{
if (!config.macros.importTiddlers.inbound) return -1;
var theList = document.getElementById('importList');
if (!theList) return;
var t;
// if starting new import, reset import status flags
if (startIndex==0)
for (var t=0;t<config.macros.importTiddlers.inbound.length;t++)
config.macros.importTiddlers.inbound[t].status="";
for (var i=startIndex; i<theList.options.length; i++)
{
// if list item is not selected or is a heading (i.e., has no value), skip it
if ((!theList.options[i].selected) || ((t=theList.options[i].value)==""))
continue;
for (var j=0;j<config.macros.importTiddlers.inbound.length;j++)
if (config.macros.importTiddlers.inbound[j].title==t) break;
var inbound = config.macros.importTiddlers.inbound[j];
var theExisting = store.getTiddler(inbound.title);
// avoid redundant import for tiddlers that are listed multiple times (when 'by tags')
if (inbound.status=="added")
continue;
// don't import the "ImportedTiddlers" history from the other document...
if (inbound.title=='ImportedTiddlers')
continue;
// if tiddler exists and import not marked for replace or merge, stop importing
if (theExisting && (inbound.status.substr(0,7)!="replace") && (inbound.status.substr(0,5)!="merge"))
return i;
// assemble tags (remote + existing + added)
var newTags = "";
if (config.macros.importTiddlers.importTags)
newTags+=inbound.getTags() // import remote tags
if (config.macros.importTiddlers.keepTags && theExisting)
newTags+=" "+theExisting.getTags(); // keep existing tags
if (config.macros.importTiddlers.addTags && config.macros.importTiddlers.newTags.trim().length)
newTags+=" "+config.macros.importTiddlers.newTags; // add new tags
inbound.set(null,null,null,null,newTags.trim());
// set the status to 'added' (if not already set by the 'ask the user' UI)
inbound.status=(inbound.status=="")?'added':inbound.status;
// do the import!
// OLD: store.addTiddler(in); store.setDirty(true);
store.saveTiddler(inbound.title, inbound.title, inbound.text, inbound.modifier, inbound.modified, inbound.tags);
store.fetchTiddler(inbound.title).created = inbound.created; // force creation date to imported value
}
return(-1); // signals that we really finished the entire list
}
//}}}
//{{{
function importStopped()
{
var theList = document.getElementById('importList');
var theNewTitle = document.getElementById('importNewTitle');
if (!theList) return;
if (config.macros.importTiddlers.index==-1)
importReport(); // import finished... generate the report
else
{
// DEBUG alert('import stopped at: '+config.macros.importTiddlers.index);
// import collision... show the collision panel and set the title edit field
document.getElementById('importCollisionPanel').style.display='block';
theNewTitle.value=theList.options[config.macros.importTiddlers.index].value;
}
}
//}}}
// // ''REPORT GENERATOR''
//{{{
function importReport(quiet)
{
if (!config.macros.importTiddlers.inbound) return;
// DEBUG alert('importReport: start');
// if import was not completed, the collision panel will still be open... close it now.
var panel=document.getElementById('importCollisionPanel'); if (panel) panel.style.display='none';
// get the alphasorted list of tiddlers
var tiddlers = config.macros.importTiddlers.inbound;
// gather the statistics
var count=0;
for (var t=0; t<tiddlers.length; t++)
if (tiddlers[t].status && tiddlers[t].status.trim().length && tiddlers[t].status.substr(0,7)!="skipped") count++;
// generate a report
if (count && config.options.chkImportReport) {
// get/create the report tiddler
var theReport = store.getTiddler('ImportedTiddlers');
if (!theReport) { theReport= new Tiddler(); theReport.title = 'ImportedTiddlers'; theReport.text = ""; }
// format the report content
var now = new Date();
var newText = "On "+now.toLocaleString()+", "+config.options.txtUserName
newText +=" imported "+count+" tiddler"+(count==1?"":"s")+" from\n[["+config.macros.importTiddlers.src+"|"+config.macros.importTiddlers.src+"]]:\n";
if (config.macros.importTiddlers.addTags && config.macros.importTiddlers.newTags.trim().length)
newText += "imported tiddlers were tagged with: \""+config.macros.importTiddlers.newTags+"\"\n";
newText += "<<<\n";
for (var t=0; t<tiddlers.length; t++) if (tiddlers[t].status) newText += "#[["+tiddlers[t].title+"]] - "+tiddlers[t].status+"\n";
newText += "<<<\n";
newText += "<html><input type=\"button\" href=\"javascript:;\" ";
newText += "onclick=\"story.closeTiddler('"+theReport.title+"'); store.deleteTiddler('"+theReport.title+"');\" ";
newText += "value=\"discard report\"></html>";
// update the ImportedTiddlers content and show the tiddler
theReport.text = newText+((theReport.text!="")?'\n----\n':"")+theReport.text;
theReport.modifier = config.options.txtUserName;
theReport.modified = new Date();
// OLD: store.addTiddler(theReport);
store.saveTiddler(theReport.title, theReport.title, theReport.text, theReport.modifier, theReport.modified, theReport.tags);
if (!quiet) { story.displayTiddler(null,theReport.title,1,null,null,false); story.refreshTiddler(theReport.title,1,true); }
}
// reset status flags
for (var t=0; t<config.macros.importTiddlers.inbound.length; t++) config.macros.importTiddlers.inbound[t].status="";
// refresh display if tiddlers have been loaded
if (count) { store.setDirty(true); store.notifyAll(); }
// always show final message when tiddlers were actually loaded
if (count) displayMessage(config.macros.importTiddlers.importedMsg.format([count,tiddlers.length,config.macros.importTiddlers.src]));
}
//}}}
/***
!!!!!TW 2.1beta Core Code Candidate
//The following section is a preliminary 'code candidate' for incorporation of non-interactive 'load tiddlers' functionality into TW2.1beta. //
***/
//{{{
// default cookie/option values
if (!config.options.chkImportReport) config.options.chkImportReport=true;
config.macros.loadTiddlers = {
label: "",
prompt: "add/update tiddlers from '%0'",
askMsg: "Please enter a local path/filename or a remote URL",
openMsg: "Opening %0",
openErrMsg: "Could not open %0 - error=%1",
readMsg: "Read %0 bytes from %1",
foundMsg: "Found %0 tiddlers in %1",
nochangeMsg: "'%0' is up-to-date... skipped.",
loadedMsg: "Loaded %0 of %1 tiddlers from %2"
};
config.macros.loadTiddlers.handler = function(place,macroName,params) {
var label=(params[0] && params[0].substr(0,6)=='label:')?params.shift().substr(6):this.label;
var prompt=(params[0] && params[0].substr(0,7)=='prompt:')?params.shift().substr(7):this.prompt;
var filter="updates";
if (params[0] && (params[0]=='all' || params[0]=='new' || params[0]=='changes' || params[0]=='updates'
|| params[0].substr(0,8)=='tiddler:' || params[0].substr(0,4)=='tag:'))
filter=params.shift();
var src=params.shift(); if (!src || !src.length) return; // filename is required
var quiet=(params[0]=="quiet"); if (quiet) params.shift();
var ask=(params[0]=="confirm"); if (ask) params.shift();
var force=(params[0]=="force"); if (force) params.shift();
if (label.trim().length) {
// link triggers load tiddlers from another file/URL and then applies filtering rules to add/replace tiddlers in the store
createTiddlyButton(place,label.format([src]),prompt.format([src]), function() {
if (src=="ask") src=prompt(config.macros.loadTiddlers.askMsg);
loadRemoteFile(src,loadTiddlers,quiet,ask,filter,force);
})
}
else {
// load tiddlers from another file/URL and then apply filtering rules to add/replace tiddlers in the store
if (src=="ask") src=prompt(config.macros.loadTiddlers.askMsg);
loadRemoteFile(src,loadTiddlers,quiet,ask,filter,force);
}
}
function loadTiddlers(src,html,quiet,ask,filter,force)
{
var tiddlers = readTiddlersFromHTML(html);
var count=tiddlers?tiddlers.length:0;
if (!quiet) displayMessage(config.macros.loadTiddlers.foundMsg.format([count,src]));
var count=0;
if (tiddlers) for (var t=0;t<tiddlers.length;t++) {
var inbound = tiddlers[t];
var theExisting = store.getTiddler(inbound.title);
if (inbound.title=='ImportedTiddlers')
continue; // skip "ImportedTiddlers" history from the other document...
// apply the all/new/changes/updates filter (if any)
if (filter && filter!="all") {
if ((filter=="new") && theExisting) // skip existing tiddlers
continue;
if ((filter=="changes") && !theExisting) // skip new tiddlers
continue;
if ((filter.substr(0,4)=="tag:") && inbound.tags.find(filter.substr(4))==null) // must match specific tag value
continue;
if ((filter.substr(0,8)=="tiddler:") && inbound.title!=filter.substr(8)) // must match specific tiddler name
continue;
if (!force && store.tiddlerExists(inbound.title) && ((theExisting.modified.getTime()-inbound.modified.getTime())>=0))
{ if (!quiet) displayMessage(config.macros.loadTiddlers.nochangeMsg.format([inbound.title])); continue; }
}
// get confirmation if required
if (ask && !confirm((theExisting?"Update":"Add")+" tiddler '"+inbound.title+"'\nfrom "+src))
{ tiddlers[t].status="skipped - cancelled by user"; continue; }
// DO IT!
// OLD: store.addTiddler(in);
store.saveTiddler(inbound.title, inbound.title, inbound.text, inbound.modifier, inbound.modified, inbound.tags);
store.fetchTiddler(inbound.title).created = inbound.created; // force creation date to imported value
tiddlers[t].status=theExisting?"updated":"added"
count++;
}
if (count) {
// refresh display
store.setDirty(true);
store.notifyAll();
// generate a report
if (config.options.chkImportReport) {
// get/create the report tiddler
var theReport = store.getTiddler('ImportedTiddlers');
if (!theReport) { theReport= new Tiddler(); theReport.title = 'ImportedTiddlers'; theReport.text = ""; }
// format the report content
var now = new Date();
var newText = "On "+now.toLocaleString()+", "+config.options.txtUserName+" loaded "+count+" tiddlers from\n[["+src+"|"+src+"]]:\n";
newText += "<<<\n";
for (var t=0; t<tiddlers.length; t++) if (tiddlers[t].status) newText += "#[["+tiddlers[t].title+"]] - "+tiddlers[t].status+"\n";
newText += "<<<\n";
newText += "<html><input type=\"button\" href=\"javascript:;\" ";
newText += "onclick=\"story.closeTiddler('"+theReport.title+"'); store.deleteTiddler('"+theReport.title+"');\" ";
newText += "value=\"discard report\"></html>";
// update the ImportedTiddlers content and show the tiddler
theReport.text = newText+((theReport.text!="")?'\n----\n':"")+theReport.text;
theReport.modifier = config.options.txtUserName;
theReport.modified = new Date();
// OLD: store.addTiddler(theReport);
store.saveTiddler(theReport.title, theReport.title, theReport.text, theReport.modifier, theReport.modified, theReport.tags);
if (!quiet) { story.displayTiddler(null,theReport.title,1,null,null,false); story.refreshTiddler(theReport.title,1,true); }
}
}
// always show final message when tiddlers were actually loaded
if (!quiet||count) displayMessage(config.macros.loadTiddlers.loadedMsg.format([count,tiddlers.length,src]));
}
function loadRemoteFile(src,callback,quiet,ask,filter,force) {
if (src==undefined || !src.length) return null; // filename is required
if (!quiet) clearMessage();
if (!quiet) displayMessage(config.macros.loadTiddlers.openMsg.format([src]));
if (src.substr(0,4)!="http" && src.substr(0,4)!="file") { // if not a URL, fallback to read from local filesystem
var txt=loadFile(src);
if ((txt==null)||(txt==false)) // file didn't load
{ if (!quiet) displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,"(unknown)"])); }
else {
if (!quiet) displayMessage(config.macros.loadTiddlers.readMsg.format([txt.length,src]));
if (callback) callback(src,convertUTF8ToUnicode(txt),quiet,ask,filter,force);
}
}
else {
var x; // get an request object
try {x = new XMLHttpRequest()} // moz
catch(e) {
try {x = new ActiveXObject("Msxml2.XMLHTTP")} // IE 6
catch (e) {
try {x = new ActiveXObject("Microsoft.XMLHTTP")} // IE 5
catch (e) { return }
}
}
// setup callback function to handle server response(s)
x.onreadystatechange = function() {
if (x.readyState == 4) {
if (x.status==0 || x.status == 200) {
if (!quiet) displayMessage(config.macros.loadTiddlers.readMsg.format([x.responseText.length,src]));
if (callback) callback(src,x.responseText,quiet,ask,filter,force);
}
else {
if (!quiet) displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,x.status]));
}
}
}
// get privileges to read another document's DOM via http:// or file:// (moz-only)
if (typeof(netscape)!="undefined") {
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); }
catch (e) { if (!quiet) displayMessage(e.description?e.description:e.toString()); }
}
// send the HTTP request
try {
var url=src+(src.indexOf('?')<0?'?':'&')+'nocache='+Math.random();
x.open("GET",src,true);
if (x.overrideMimeType) x.overrideMimeType('text/html');
x.send(null);
}
catch (e) {
if (!quiet) {
displayMessage(config.macros.loadTiddlers.openErrMsg.format([src,"(unknown)"]));
displayMessage(e.description?e.description:e.toString());
}
}
}
}
function readTiddlersFromHTML(html)
{
// extract store area from html
var start=html.indexOf('<div id="storeArea">');
var end=html.indexOf('</body>',start);
var sa="<html><body>"+html.substring(start,end)+"</body></html>";
// load html into iframe document
var f=document.getElementById("loaderFrame"); if (f) document.body.removeChild(f);
f=document.createElement("iframe"); f.id="loaderFrame";
f.style.width="0px"; f.style.height="0px"; f.style.border="0px";
document.body.appendChild(f);
var d=f.document;
if (f.contentDocument) d=f.contentDocument; // For NS6
else if (f.contentWindow) d=f.contentWindow.document; // For IE5.5 and IE6
d.open(); d.writeln(sa); d.close();
// read tiddler DIVs from storeArea DOM element
var sa = d.getElementById("storeArea");
if (!sa) return null;
sa.normalize();
var nodes = sa.childNodes;
if (!nodes || !nodes.length) return null;
var tiddlers = [];
for(var t = 0; t < nodes.length; t++) {
var title = null;
if(nodes[t].getAttribute)
title = nodes[t].getAttribute("tiddler");
if(!title && nodes[t].id && (nodes[t].id.substr(0,5) == "store"))
title = nodes[t].id.substr(5);
if(title && title != "")
tiddlers.push((new Tiddler()).loadFromDiv(nodes[t],title));
}
return tiddlers;
}
//}}}
On Wednesday, September 20, 2006 7:30:06 AM, Russ Herman imported 1 tiddler from
[[C:\WorkFiles\Fall2006\index.htm|C:\WorkFiles\Fall2006\index.htm]]:
<<<
#[[Mathematics Writing]] - replaces Mathematics Writing - 8/27/2006 12:37:00 by Russ Herman
<<<
<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
----
On Wednesday, September 20, 2006 7:21:55 AM, Russ Herman imported 1 tiddler from
[[C:\WorkFiles\Fall2006\index.htm|C:\WorkFiles\Fall2006\index.htm]]:
<<<
#[[Mathematics Writing]] - added
<<<
<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
----
On Sunday, September 10, 2006 10:57:14 PM, Russ Herman imported 1 tiddler from
[[C:\WorkFiles\Fall2006\Wiki\ChaosWiki.htm|C:\WorkFiles\Fall2006\Wiki\ChaosWiki.htm]]:
<<<
#[[Plugin: jsMath]] - added
<<<
<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
----
On Sunday, September 10, 2006 2:54:29 PM, Russ Herman imported 1 tiddler from
[[C:\WorkFiles\Fall2006\index.htm|C:\WorkFiles\Fall2006\index.htm]]:
<<<
#[[LaTeX]] - added
<<<
<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
----
On Sunday, September 10, 2006 2:34:44 PM, Russ Herman imported 1 tiddler from
[[C:\WorkFiles\Fall2006\WikiNotes\WikiNotes.html|C:\WorkFiles\Fall2006\WikiNotes\WikiNotes.html]]:
<<<
#[[InlineJavascriptPlugin]] - added
<<<
<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
----
On Sunday, September 10, 2006 2:32:28 PM, Russ Herman imported 7 tiddlers from
[[C:\WorkFiles\Fall2006\Wiki\ChaosWiki.htm|C:\WorkFiles\Fall2006\Wiki\ChaosWiki.htm]]:
<<<
#[[Configuration]] - added
#[[StyleSheet]] - added
#[[StyleSheets]] - added
#[[SystemLayout]] - added
#[[SystemSideBars]] - added
#[[SystemTiddlers]] - added
#[[ViewTemplate]] - added
<<<
<html><input type="button" href="javascript:;" onclick="story.closeTiddler('ImportedTiddlers'); store.deleteTiddler('ImportedTiddlers');" value="discard report"></html>
''What is ~LaTeX?''
~LaTeX is a document editing system for producing scientific documents with properly typeset equations. It has been a standard for preparing professional articles and theses in mathematics and physics for several decades. This site was designed for use in both the Mathematics Senior Seminar and for the Graduate Thesis preparation. You will find at this site
* [[How to Obtain|Software]] ~LaTeX and Editors for Typing Your Papers
* How to [[Start a Paper|Starting an Article]]
* [[Advanced Editing]]
** Links to ~LaTeX Commands for [[Typing Mathematics|Typing Mathematics]]
** How to Write Papers with [[Mathematical Expressions|Writing Mathematics]]
** [[How To Insert Tables, Figures, etc.|Advanced Editing]]
** How to Produce [[Presentations]] with Mathematics
*** [[Beamer]]
***[[Beamer2]] - contains new examples and LaTeX file: [[BeamerExample.pdf|BeamerExample.pdf]]
***[[Beamer Template|http://people.uncw.edu/hermanr/mat495/#BeamerTemplate]] at the MAT 495 course site.
**How to fill PDF page with text, [[PDF Layout]]
**How to make [[Posters]]
*Style Files for UNCW [[Masters Theses|Masters Theses]]
* Online [[Help and Tutorials]]
* [[Live Previews]] gives list of online editors
<html><iframe src="http://web.ift.uib.no/Fysisk/Teori/KURS/TeX/latex1.html" style="width:100%;height:400px"></iframe></html>
{{{http://web.ift.uib.no/Fysisk/Teori/KURS/TeX/latex1.html}}}
There are several ways to get mathematics typeset in presentation slides or transparencies. Some of these are covered in the section [[Presentations]]. In this section we will focus on two methods. The first is the simple seminar style and the other gives examples of more interactive presentation slides using [[Prosper]].
!!The Seminar Style
This is a simple implementation of the seminar style. Theheader begins with
{{{
\documentclass[semrot,portrait,sem-a4]{seminar}
}}}
You can control the global font size by adding
{{{
\slidesmag{4}
}}}
The first page is the title page. We begin with
{{{
\begin{document}
\begin{slide}
\begin{center} \begin{large} {\bf {Sample Seminar Slides}}\end{large} \\ Russell L. Herman
\\ University of North Carolina Wilmington, Wilmington, NC \end{center} \addvspace{1cm}
\abstract{We show a simple slide layout using the seminar style.}
\end{slide}
}}}
The next slides show some simple features:
{{{
\begin{slide}
\section*{Title for Slide 1}
{\bf Galilean Transformation:}
\begin{equation}
u_t+6uu_x+u_{xxx}=0, \label{sKdV}
\end{equation}
where $u_t = \frac{\partial u}{\partial t}$
\addvspace{1cm}
... and more can be said about this.
\end{slide}
}}}
You can list your points using a numbered list.
{{{
\begin{slide}
\section*{Numbering Your Points}
You can list your points
\begin{enumerate}
\item First item
\item Second item
\item Third item
\begin{enumerate}
\item Fourth item
\item Fifth item
\end{enumerate}
\item Sixth item
\end{enumerate}
\end{slide}
}}}
You may prefer to use bullets.
{{{
\begin{slide}
\section*{Using Bullets}
You can itemize your points
\begin{itemize}
\item First item
\item Second item
\item Third item
\begin{itemize}
\item Fourth item
\item Fifth item
\end{itemize}
\item Sixth item
\end{itemize}
\end{slide}
}}}
Of course, you need to end the document with the usual command:
{{{
\end{document}
}}}
The full file is in [[sample1.tex|sample1.tex]] and a [[PDF Version|sample1.pdf]] is also provided. In order to view your slides, you can create a dvi file and then convert the dvi to pdf. In order to view these slides you need to rotate the pages in the Acrobat reader and view full screen. You can format the files even more. See the [[Seminar FAQ|http://www.tug.org/applications/Seminar/Seminar-FAQ.html]].
<html><iframe src="http://omega.albany.edu:8008/Symbols.html" style="width:100%;height:400px"></iframe></html>
{{{http://omega.albany.edu:8008/Symbols.html}}}
Here are some links to online previewers and editors. These do not rely on downloading software to your machine. Some require signing up before using. Most of these have not been tested locally. ~ScribTeX and ~ShareTeX were used in previous semesters.
!Previewers
*[[MathJax Live Session|http://www.math.tohoku.ac.jp/~kuroki/MathJax/LivePreviewMathJax.html]]
*[[ScienceSoft|http://sciencesoft.at/latex/?lang=en]]
!Online Editors
*[[WriteLaTeX|https://www.writelatex.com/]] - Is now called'' Overleaf''
*[[Authorea|https://www.authorea.com]]
*[[JaxEdit|http://jaxedit.com/]]
*[[ShareLaTeX|https://www.sharelatex.com/]] - Need to sign in
*[[LaTeXLab|http://www.latexlab.org/]] - Connects to Googledocs account
*[[LaTeX Online Compiler|http://latex.informatik.uni-halle.de/latex-online/latex.php]] - Bare bones window
*[[TeXOnWeb|http://tex.mendelu.cz/en/]] - Bare bones window
*[[Blue LaTeX |http://www.publications.li/blue]] - Need to register.
!Other Items
Check out [[Web Equation|http://webdemo.visionobjects.com/portal.html?locale=default&utm_source=buffer&buffer_share=9ae66]] for handwritten note conversion to LaTeX.
''Using ~LaTeX''
[[Starting an Article]]
[[Typing Mathematics]]
[[Advanced Editing]]
-----------------------------
''Special Resources''
[[Writing Mathematics]]
[[Presentations]]
[[Masters Theses]]
[[Honors Thesis]]
[[Software]]
-----------------------
''Help''
[[Help and Tutorials]]
[[UNCW Contact]]
-----------------------
{{small{
<<search>>
<<closeAll>>
<<permaview>>
<<newTiddler>>
<<saveChanges>>
[[Import Tiddlers]]}}}
-----------------------
{{smaller{[[by Dr. R. Herman.|http://people.uncw.edu/herman]]}}}
Masters theses in the Department of Mathematics and Statistics at UNCW are prepared using LaTeX. In order to adhere to University guidelines, a thesis format was formally accepted by the Graduate School in 2001 and periodically updated. The files needed are provided here. You will need to download these files and make the appropriate replacements in the preamble and add you own content. Any questions on the thesis format can be directed to Dr. Herman. @@ See also [[Honors Thesis]] for Honors Thesis files.@@
@@These files have been updated as of January 18, 2023@@. There are separate title pages with committee member names typed as well as a blank page for obtaining signatures.
# Examples - PDF
##[[Sample Thesis|http://people.uncw.edu/hermanr/LaTeX/UNCW_Thesis/thesis.pdf]]
# Title Page LaTeX Files
##[[Title Page - Blank|http://people.uncw.edu/hermanr/LaTeX/UNCW_Thesis/TitleBlank.tex]]
##[[Title Page - with Names|http://people.uncw.edu/hermanr/LaTeX/UNCW_Thesis/TitleWithNames.tex]]
You should begin with the files in the [[UNCW_Thesis.zip|http://people.uncw.edu/hermanr/LaTeX/uncw_thesis/UNCW_Thesis.zip]] file. The sample thesis has comments and serves as an example of how you should begin your thesis document. There may be other files needed depending upon which front end you are using to run LaTeX. It is assumed that you are using LaTeX 2.09e. //Right-click to download to your computer.//
# UNCW Thesis Style file [[uncw_thesis.cls|http://people.uncw.edu/hermanr/LaTeX/uncw_thesis/uncw_thesis.cls]] - This file was updated Nov 15, 2007.
# Sample Thesis
##[[Main Body|http://people.uncw.edu/hermanr/LaTeX/UNCW_Thesis/thesis.tex]].
##[[Chapter 2|http://people.uncw.edu/hermanr/LaTeX/uncw_thesis/chap2.tex]]
##[[Bibliography|http://people.uncw.edu/hermanr/LaTeX/uncw_thesis/biblio.tex]]
##[[Appendix|http://people.uncw.edu/hermanr/LaTeX/uncw_thesis/appendix.tex]]
# Beginning Files - [[UNCW_Thesis.zip|http://people.uncw.edu/hermanr/LaTeX/uncw_thesis/UNCW_Thesis.zip]] - Most of the files you will need are packaged in this file. Save it to your machine and use an unzip utility. Extract the files and make sure you check that paths/folders are kept.
After downloading the files, you should explore the content and make the needed changes. Graduate students may learn to use LaTeX in MAT 595. However, more advanced techniques are covered in other sections of this site. Sometimes you may need additional [[Style Files]], or you might need to know how to create special formatting. (See [[Advanced Editing]].) Feel free to contact the experts in the department. In the meantime look over this site for help and how to information on creating your thesis and presentations. Also, you might want to look at the [[Figures]] section for samples. Some of the figure demos are included in the above zip file.
''Note 1'' When printing PDF files, sometimes the margins are off. Test one page in your document to make sure the printed margins are correct. Often, the print screen has boxes checked which distort the printed pages. Make sure these are unchecked, or you will have problems with the margins when you go to the Graduate School for approval.
''Note 2'' The layout in these files will save you time and sticking to these formats will ensure that our theses are consistent with the departmentally approved formatting.
''Note 3'' You should keep the packages shown in the preamble of the main body. This provides indentation of the first paragraph of each section (Chapter). Also, you need to create each chapter title as follows:
{{{
\newpage
\section{TITLE IN CAPS}
\thispagestyle{plain}
}}}
This will show up in the Table of Contents correctly, begin new chapters on new pages, and you will get the first page of each chapter numbered. Also, for the first chapter, make sure you change the page numbering style. All of this can be found in the above sample thesis.
/***
|''Name:''|MathJaxPlugin|
|''Description:''|Enable LaTeX formulas for TiddlyWiki|
|''Version:''|1.0.1|
|''Date:''|Feb 11, 2012|
|''Source:''|http://www.guyrutenberg.com/2011/06/25/latex-for-tiddlywiki-a-mathjax-plugin|
|''Author:''|Guy Rutenberg|
|''License:''|[[BSD open source license]]|
|''~CoreVersion:''|2.5.0|
!! Changelog
!!! 1.0.1 Feb 11, 2012
* Fixed interoperability with TiddlerBarPlugin
!! How to Use
Currently the plugin supports the following delemiters:
* """\(""".."""\)""" - Inline equations
* """$$""".."""$$""" - Displayed equations
* """\[""".."""\]""" - Displayed equations
!! Demo
This is an inline equation \(P(E) = {n \choose k} p^k (1-p)^{ n-k}\) and this is a displayed equation:
\[J_\alpha(x) = \sum_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha}\]
This is another displayed equation $$e=mc^2$$
!! Code
***/
//{{{
config.extensions.MathJax = {
mathJaxScript : "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
// uncomment the following line if you want to access MathJax using SSL
// mathJaxScript : "https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
displayTiddler: function(TiddlerName) {
config.extensions.MathJax.displayTiddler_old.apply(this, arguments);
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}
};
jQuery.getScript(config.extensions.MathJax.mathJaxScript, function(){
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
extensions: ["tex2jax.js"],
"HTML-CSS": { scale: 100 }
});
MathJax.Hub.Startup.onload();
config.extensions.MathJax.displayTiddler_old = story.displayTiddler;
story.displayTiddler = config.extensions.MathJax.displayTiddler;
});
config.formatters.push({
name: "mathJaxFormula",
match: "\\\\\\[|\\$\\$|\\\\\\(",
//lookaheadRegExp: /(?:\\\[|\$\$)((?:.|\n)*?)(?:\\\]|$$)/mg,
handler: function(w)
{
switch(w.matchText) {
case "\\[": // displayed equations
this.lookaheadRegExp = /\\\[((?:.|\n)*?)(\\\])/mg;
break;
case "$$": // inline equations
this.lookaheadRegExp = /\$\$((?:.|\n)*?)(\$\$)/mg;
break;
case "\\(": // inline equations
this.lookaheadRegExp = /\\\(((?:.|\n)*?)(\\\))/mg;
break;
default:
break;
}
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
createTiddlyElement(w.output,"span",null,null,lookaheadMatch[0]);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
});
//}}}
There is a Portable ~MikTeX which also has the [[TeXWorks|http://www.tug.org/texworks/]] editor. This is useful for working on computers on campus which do not have LaTeX. The [[installation instructions|http://www.miktex.org/portable]] are easy to follow.
Links found but not necessarily inserted into rest of site yet.
*PDF LaTeX by Example http://www.maths.manchester.ac.uk/~kd/latextut/pdfbyex.htm
*TexPoint � convert eqns to bmps? http://texpoint.necula.org/
Here are some links to various online LaTeX viewers which can be used to test blocks of expressions. In some cases, you can capture the images and use them in other documents.
*[[Hamline University Physics Department Latex Equation Editor|http://www.hamline.edu/~arundquist/equationeditor/ ]]
*[[TeXify|http://www.texify.com/]] Create gif images or links for email, web pages PPT or Google docs
*[[Online Equation Editor|http://www.codecogs.com/components/equationeditor/equationeditor.php]]
*[[LaTeX Servlet|http://sciencesoft.at/index.jsp?link=latex&lang=en]] Converts to image files There is also a [[Flash Applet|http://sciencesoft.at/latex/flatex.gsp?lang=en]]
*[[HotEqn The IMGless Equation Viewer Applet|http://www.atp.ruhr-uni-bochum.de/VCLab/software/HotEqn/HotEqn.html]] A Java Applet
*[[LaTeX Previewer|http://www.tlhiv.org/ltxpreview/]]
*[[Host Math|http://www.hostmath.com/]]
Check out [[Live Previews]] for handling documents online.
Here is an example of how you can make sure the PDF of your paper fills the page. Also, the fontsize is set to 11 pt and an example of a figure is provided for JPEG output.
{{{
\documentclass[11pt]{article}
\usepackage{amsmath,amsthm}
\usepackage{url}
\usepackage{graphicx}
\pdfpagewidth 8.5in
\pdfpageheight 11in
\setlength\topmargin{0in}
\setlength\headheight{0in}
\setlength\headsep{0in}
\setlength\textheight{7.7in}
\setlength\textwidth{6.5in}
\setlength\oddsidemargin{0in}
\setlength\evensidemargin{0in}
\setlength\parindent{0.25in}
\setlength\parskip{0.25in}
\title{My Title}
\author{My Name}
\date{April 18, 2009}
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}
\begin{document}
\maketitle
\begin{abstract}
Here is where you place abstract
\end{abstract}
\section{First Section}
Now start typing. Note that you can add a url using the url package and then writing the site as \url{http://people.uncw.edu/hermanr/}. Also, you can add figures. For a JPG you can write the code:
\begin{figure}[htb]
\centering
\includegraphics[width=2in]{myfig.jpg}
\caption{This is a blah ...}
\label{myfig}
\end{figure}
\end{document}
}}}
<div class='header'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
*[[Conference poster templates|http://www.latextemplates.com/cat/conference-posters]]
*[[Writing posters with beamerposter package in LATEX|http://www.google.com/url?q=http://tug.org/pracjourn/2012-1/shang/shang.pdf]] pdf
*[[Writing posters in LATEX|http://www.google.com/url?q=http://tug.org/pracjourn/2008-3/morales/morales.pdf]] pdf
*[[beamerposter package|http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php]]
*[[a0poster|http://andreas.welcomes-you.com/projects/a0poster/]]
*[[fancytikzposter|http://www.inf.unibz.it/~ebotoeva/fancytikzposter.html]]
*~LaTeX [[poster template|http://www.brian-amberg.de/uni/poster/]] using baposter
Note - In MAT 495 we will be using [[Beamer]]. (See also [[Beamer2]] and the [[Beamer Template|http://people.uncw.edu/hermanr/mat495//index.html#BeamerTemplate]] at the course site.) Read the [[Intro to Beamer|http://people.uncw.edu/hermanr/mat495/beamerIntro.pdf]].
! Choose A Presenter
There are many ways to do a mathematics presentation. While this is a LaTeX site, one is often faced with the choice of going with Microsoft ~PowerPoint or pure LaTeX. Here we describe several methods:
* ~PowerPoint
** Using the Equation Editor
** Using ~TeX4PPT
* Using LaTeX
** Seminar Style - originally for transparencies
**Other Styles
*** [[Prosper]] - relatively easy
*** [[Beamer]] - Seemingly more complicated
*** Other Styles
* Other Presentation Platforms
**[[Impress|http://www.openoffice.org/product/impress.html]] from [[Open Office|http://www.openoffice.org/]]
*** [[How to insert LaTeX equations|http://brahms.phy.vanderbilt.edu/~rknop/linux/teximpress.html]]
*** See [[Doing Equations, Formulas, Pi, Etc. in OpenOffice Writer and Calc, and Impress|http://openoffice.blogs.com/openoffice/2008/05/doing-equations.html]]
! ~PowerPoint
The typical format for presentations is Microsoft's ~PowerPoint application. However, inserting mathematical expressions in ~PowerPoint is not always easy and the product if often imperfect. Microsoft Office comes with an ''Equation Editor''. It is not installed by default and one has to set up the ''Equation Editor''.
!! Equation Editor
Installing ''Equation Editor''
*Go to ''Tools''.
*Select ''...Customize''.
*Click on the tab ''Commands''.
*Under ''Categories'' pick ''Insert''.
*Scroll through the right list and find ''Equation Editor'' and drag to the Toolbar.
*Doubleclick the icon for the Equation Editor and enter your equation.
In some cases you may need the installation CD to complete this task.
!! Other Methods
There are other methods for putting mathematical expressions into ~PowerPoint. One is to capture images of the equations and put them in as images. This leads to unprofessional looking equations. One could get [[MathType|http://www.dessci.com/en/products/mathtype/]], but this is is not free. There are some [[Online LaTeX Viewers]] that allow capturing images of ~TeXed equations that you can paste into your documents.
!!~TeX4PPT
Another route is to use [[TeX4PPT|http://www.ecs.soton.ac.uk/~srg/softwaretools/presentation/TeX4PPT/]]. This allows one to insert LaTeX commands into ~PowerPoint. However, one needs LaTeX installed on the system.
!Using LaTeX
It is also possible to create slides using LaTeX. The simplest method is to use the seminar style. More sophisticated methods which produce results similar to ~PowerPoint are listed below.
!!Seminar Style - Old Method
One common method for writing slides and transparencies using LaTeX is to use the seminar style. Slides are then either printed, or displayed via a postscript reader or a PDF reader.
*[[Making Slides in LaTeX|http://astronomy.sussex.ac.uk/~eddie/soft/tutorial.html]]
*[[Seminar FAQ|http://www.tug.org/applications/Seminar/Seminar-FAQ.html]]
*[[Quick and Dirty LaTeX Tips|http://www.sci.usq.edu.au/staff/robertsa/LaTeX/ltxfloats.html#Seminar]]
Here is a simple, but effective way to produce talks and run them full screen in you favorite PDF reader.
*[[PDF Seminar|http://www.maths.monash.edu.au/~leo/examples/pdfseminar/]] - [[Example|http://www.maths.monash.edu.au/~leo/examples/pdfseminar/manual.pdf]]
Go to [[LaTeX Slides]] for more help on preparing a presentation using the seminar style.
!! Using Prosper
Prosper is now included in the recent ~MikTeX installation. Using the Prosper style files is relatively easy an a discussion and an example is provided at the links [[Prosper]] and [[Prosper2]] (a more recent example). Other links are:
*[[Making Presentations with LaTeX and Prosper|http://freshmeat.net/articles/view/667/]],
*[[Screenshots|http://prosper.sourceforge.net/screenshots-prosper.html]],
*[[Tutorial|http://heather.cs.ucdavis.edu/%7Ematloff/prosper.html]]
*[[PDF Prosper Guide|http://us.share.geocities.com/kijoo2000/beamer_guide.pdf]] at [[Ki-Joo's LaTeX Site|http://us.share.geocities.com/kijoo2000/]]
!!Other Styles
Here are a few links with some examples of what can be done using LaTeX plus some additional style files. See [[Beamer]] and [[Beamer2]] for more about one of these styles.
*[[Beamer LaTeX Class|http://latex-beamer.sourceforge.net/]], [[Tutorial|http://heather.cs.ucdavis.edu/%7Ematloff/beamer.html]]
*[[TeXPower|http://texpower.sourceforge.net/]]
*[[More packages|http://www.miwie.org/presentations/presentations.html]]
This is one of two examples at this site for using Prosper. The example below shows some simple slides using bullets and overlays.
The LaTeX file for this example is [[tempOverlay.tex|tempOverlay.tex]] and the talk can be viewed as [[tempOverlay.pdf|tempOverlay.pdf]]. [[Another anotated example|Prosper2]] is provided at this site. It shows some other features and the use of figures in Prosper slides. An [[old talk|http://people.uncw.edu/hermanr/documents/searcde06.pdf]] shows Prosper in action.
!!Prosper Help
There are several good sites on using Prosper and displaying some of the standard themes.
*[[UMBC Tutorial|http://www.math.umbc.edu/~rouben/prosper]]
*[[Making Presentations with Latex and Prosper|http://freshmeat.net/articles/view/667/]]
*[[LaTeX prosper class for making LaTeX/PDF slide shows|http://amath.colorado.edu/documentation/LaTeX/prosper/]]
*[[Quick Tutorial on the Prosper Package|http://heather.cs.ucdavis.edu/%7Ematloff/prosper.html]]
*http://prosper.sourceforge.net
*[[Propser Themes|http://wikiprosper.bbclone.de/index.php?pagename=ProsperThemes]] at [[WikiProsper|http://wikiprosper.bbclone.de/index.php?pagename=WikiProsper]]
!!Using Prosper
Begin with the documentclass with some simple optionscalling the prosper class. Note that you can replace ''capsules'' with a different style that can be found at the above sites. You may need to download the given class. You can also design your own with enough experience.
{{{
\documentclass[capsules,pdf,colorBG,slideColor]{prosper}
}}}
The next line causes the generated pdf to load automatically at full screen.
{{{
\hypersetup{pdfpagemode=FullScreen}
}}}
Add your title, subtitle and name to the presentation.
{{{
\title{Presentation Title}
\subtitle{with a subtitle}
\author{Dr. R. L. Herman}
}}}
You can have different transitions. The default is just to show the slides without a transition.
{{{
%\DefaultTransition{Wipe} %%% Optional Slide Transition
}}}
Slides are then entered under the document body. The title slide is first shown using the maketitle command.
{{{
\begin{document}
\maketitle
}}}
Other slides are contained in a {{{\begin{slide} }}} - {{{\end{slide} }}} environment. The title of each slide is added as an option in the form {{{\begin{slide}{title} }}}.
{{{
\begin{slide}{Slide 2}
This is the first non-Title slide.
\end{slide}
}}}
Fancy revealing of your points and equations can be done using overlays. First indicate the number of overlays. Using {{{itemstep}}} will list items sequentially.
{{{
\overlays{4}{
\begin{slide}{Slide 3 - Itemized List}
\begin{itemstep}
\item Item 1
\item Item 2
\item Item 3
\begin{itemize}
\item Subitem 1
\item Subitem 2
\end{itemize}
\item Item 4
\end{itemstep}
\end{slide}}
}}}
Here is an example in which the first text line changes as each equation is revealed.
{{{
\overlays{3}{
\begin{slide}{Slide 4}
\onlySlide*{1}{Consider the integral.}
\fromSlide*{2}{Substitute an identity.}
\fromSlide{1}{ $$ I = \int_0^\pi \sin^2x\, dx $$ }
\fromSlide{2}{ $$\sin^2x = \frac 12 (1-\cos 2x) $$ }
\onlySlide{3}{ $$ I = \frac 12 \int_0^\pi (1-\cos 2x)\, dx $$ }
\end{slide}}
}}}
Do not forget a conlcuding slide!
{{{
\begin{slide}{Last Slide}
My conclusions are
\addvspace{2cm}
... Thank you for coming!
\end{slide}
\end{document}
}}}
Compile your tex file. Convert the dvi to ps in landscape and then convert the ps file to pdf.
Here is an example for doing a presentation in Prosper. The related files are:
* PDF file [[prosper.pdf|prosper.pdf]]
* LaTeX File [[prosper.tex|prosper.tex]]
* Image files
**[[sine1.eps|sine1.eps]]
**[[sine2.eps|sine2.eps]]
**[[sine3.eps|sine3.eps]]
**[[sine4.eps|sine4.eps]]
**[[sine5.eps|sine5.eps]]
**[[myplot.eps|myplot.eps]]
A description of the lines in the files is given below. Note that for //~TeXnicCenter// to work, you need to choose the called routines as ~LaTeX => PS => PDF. The paper size should be A4 in Landscape in other editors.
A similar example in [[Beamer]] is in [[Beamer2]].
!Annotated Example
First, enter the opening line with the theme declared.
{{{
\documentclass[autumn,pdf,slideColor,colorBG]{prosper}
}}}
You can check out the other themes at http://wikiprosper.bbclone.de/index.php?pagename=ProsperThemes
The next line allows the final pdf to open full screen
{{{
\hypersetup{pdfpagemode=FullScreen}
}}}
There are several transiton styles. As these can be distracting, you should not do something too out of hand.
{{{
\DefaultTransition{Wipe}
}}}
Now, you can set up the title and author information:
{{{
\title{Sample Prosper Talk}
\subtitle{how to create a LaTeX talk}
\author{Russell L. Herman}
\email{hermanr@uncw.edu}
\institution{
Department of Mathematics \& Statistics \\
University of North Carolina Wilmington \\
Wilmington, NC, 28401 USA
}
}}}
The slide caption appears at the bottom of each slide.
{{{
\slideCaption{\textit{MAT 495 Math Seminar}}
}}}
Now you can begin the document. Each slide after the title page needs to begin with {{{\begin{slide}}}} and finish with {{{\end{slide}}}}.
{{{
\begin{document}
\maketitle
\begin{slide}{Abstract}
\begin{small}
You can put your abstract here.
\end{small}
\end{slide}
}}}
All talks need to begin with an outline. Here you can ''enumerate'' the topics to be discussed. These items will show up all at once, showing how the ''enumerate environment'' works.
{{{
\begin{slide}{Outline}
Start with a summary of the talk
\begin{enumerate}
\item The Problem
\item Some History
\item Background Material
\item Present Methods
\item Results
\item Summary
\item Conclusion
\end{enumerate}
\end{slide}
}}}
Those familiar with ~PowerPoint will want to reveal their points, or portions of a slide, in pieces. This is done using ''overlays''. If you know the number of overlays, you can indicate them up front with the {{{\ overlays{5}{% ... }}}} environment. \\Play with the number to get it to work right.\\ If you do this with items, you can simply use the ''itemstep'' command.
{{{
\overlays{5}{%
\begin{slide}{Outline}
\begin{itemstep}
\item Show items one at a time
\begin{itemize}
\item and some subitems
\item and more
\end{itemize}
\item Each revealed item is an overlay
\item and that is enough to begin
\item Even equations like $x^2+1=0$ will work
\item or displayed expressions $$ \left(\begin{array}{cc}
1 & 2 \\
3 & 4 \\
\end{array}\right)$$
\end{itemstep}
\end{slide}
}
}}}
{{{
\overlays{6}{%
\begin{slide}{Compiling}
There are several steps to producing the PDF of your talk:
\begin{itemstep}
\item Create tex file
\item Run LaTeX and fix errors
\item Run dvi2ps
\begin{itemstep}
\item Set to Landscape
\item Set paper to "-P pdf -t A4"
\end{itemstep}
\item Run ps2pdf
\end{itemstep}
\end{slide}
}
}}}
Adding figures is simple, though you might want to put text on the side and not just above or below the figure. Generally, you need to convert your figures to EPS (Encapsulated Postscript). //Instructions might be given later for doing this directly or converting other figure formats to EPS.//
In this example you see the command {{{\includegraphics[height=25mm]{myplot.eps}}}} for embedding figures. Also, the ''verbatim'' environment is used to produce exactly what appears. (This is useful for displaying programs, etc.)
{{{
\begin{slide}{Adding Figures}
Adding figure is tricky but worth the effort!
You need to convert your figures to eps format. Matlab, Maple, and
other programs can do this with some ease. For other images you
might need an image editor like GIMP. Then use
\begin{verbatim}
\begin{center}
\includegraphics[height=25mm]{myplot.eps}
\end{center}
\end{verbatim}
This gives
\begin{center}
\includegraphics[height=25mm]{myplot.eps}
\end{center}
\end{slide}
}}}
Now we take the figure and place text on the side using the ''minipage'' environment. Adjust the sizes of the pages to see the efffects.
{{{
\begin{slide}{Let's Get Fancy}
OK, you want text and a picture side by side. Can we do that? Yes!
Use the minipage environment.
\begin{minipage}{2in}
\begin{center}
\includegraphics[height=25mm]{myplot.eps}
\end{center}
\end{minipage}
\begin{minipage}{2in}
\begin{tabular}{l}
\\
Add some text in an array \\
and you can create a nice \\
slide.\\
\\
\end{tabular}
\end{minipage}
How is that?
\end{slide}
}}}
If you have several figures, you can use the ''minipage'' environment to line up bulleted descriptions. Revealing any text, equation, or figure repolacing others, uses the command {{{\onlySlide*{#}}}} where {{{#}}} is filled in with the only overlay on which it is used.
{{{
\overlays{5}{
\begin{slide}{Displaying Several Images}
\begin{tabular}{rc}
\begin{minipage}{4cm}
\onlySlide*{1}{\includegraphics[height=3cm]{sine1.eps}}
\onlySlide*{2}{\includegraphics[height=3cm]{sine2.eps}}
\onlySlide*{3}{\includegraphics[height=3cm]{sine3.eps}}
\onlySlide*{4}{\includegraphics[height=3cm]{sine4.eps}}
\onlySlide*{5}{\includegraphics[height=3cm]{sine5.eps}}
\end{minipage} &
\begin{minipage}{6cm}
\begin{itemstep}
\item Consider $f(x)=\sin x$
\item Horizontal Shift $f(x)=\sin (x+2)$
\item Vertical Shift $f(x)=\sin x+2$
\item Reflection $f(x)=-\sin x$
\item Compression \\ $f(x)=0.5\sin x$
\end{itemstep}
\end{minipage}
\end{tabular}
\end{slide}}
}}}
Do not forget to end your talk with a summar page, references and (of course) acknowledgements to your advisor or other people important in creating your talk.
{{{
\begin{slide}{That's All Folks!}
Thank you! \vskip 2cm
Acknowledgments
\vskip 2cm
References ...
\end{slide}
\end{document}
}}}
Other ideas can be found at the links and in the example given in [[Prosper]].
You should have some idea as to the layout of the paper. All papers should have and introduction and a conclusion. The introduction introduces the problem, its importance, some relevant discussion of its history and summarize for the reader what you will be doing. The conclusion is a review of what you have said in the rest of the paper and highlight the results and possible future directions of research.
These sections and the sections making up the body of the paper can be entered using a section command. The structure is typed as
{{{
\section{Introduction}
\section{Topic 1}
\section{Topic 2}
\section{Topic 3}
\section{Conclusion}
}}}
you can even add subsections and subsubsections:
{{{
\section{Introduction}
\section{Topic 1}
\subsection{Subtopic a}
\subsection{Subtopic b}
\subsubsection{Subsubtopic a}
\subsubsection{Subsubtopic b}
\section{Topic 2}
\section{Topic 3}
\section{Conclusion}
}}}
Next: [[Theorems]]
config.options.txtUserName = "Russ Herman";
There are many styles available for producing a mathematical, or physics, paper. The most commonly used style is the article style. Open up your favorite LaTeX editor. Bring up a blank new file and enter
{{{
\documentclass{article}
}}}
The content of your paper lies between two document statements. Type
{{{
\begin{document}
\end{document}
}}}
There are other parameters that can be entered in the article style, but we will return to them in a later section. Next: [[Title and Author]]
<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal 'DD MMM YYYY'>><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel 'options �' 'Change TiddlyWiki advanced options'>><< ImportTiddlers >>
an introduction for students
For thesis preparation it is recommended that you install LaTeX on your desktop or laptop. For short papers you might also try an online editor such as [[WriteLaTeX.com|https://www.writelatex.com/]] or others listed in [[Live Previews]].
!LaTeX Installation
There are many implementations of LaTeX currently available. LaTeX runs on many operating systems, however we use MS Windows, so we will list different resources for this OS. For additional help see [[Getting Started with TeX, LaTeX, and Friends|http://www.tug.org/begin.html]]. It refers to [[MacTeX|http://www.tug.org/mactex/]] for Mac Users. Also, check out [[TeXShop|http://pages.uoregon.edu/koch/texshop/]] for the Mac.
The Standard these days is [[MikTeX|http://www.miktex.org/]]. As of this writing the current version is 2.9. There are several installers:
*''Basic Installer'' - This is a minimal setup meant to be installed on machines with limited space and it downloads from the website quicker.
*''Net Installer'' - This is a complete ~TeX/LaTeX system, providing all LaTeX packages and it is huge.
*''[[MikTeX Portable]]'' - This gives a portable version that can be used on a memory stick.
#Go to the [[MikTeX|http://www.miktex.org/]] site and navigate to the download page.
#Select an installer.
#After [[MikTeX|http://www.miktex.org/]] is installed, you can edit using ~TeXworks or install your own editor.
## To open ~TeXworks: Check the Start Menu Programs - ~MikTeX 2.9 - ~TeXworks.
## You might want to make a shortcut to this on the desktop.
## You can also type texworks in the Run box.
Now go to [[Starting an Article]].
!!LaTeX Sites
There are other installations which provide a version of ~MikTeX and extras, such as editors.
*[[LyX|http://www.lyx.org/]] - a WYSIWYG word processor with LaTeX in the background. [[Windows version|http://wiki.lyx.org/Windows/Windows]] is available.
*[[Protext|http://www.tug.org/protext/]] - a LaTeX installation based on ~MikTeX.
*[[TEXLive|http://www.tug.org/texlive/]] - another LaTeX installation,which includes Protext. However the [[Windows Installation|http://tug.org/texlive/doc/texlive-en/live.html#x1-200006]] may be a bit complicated for students.
[[LaTeX Site|http://www.latex-project.org/]]
[[MikTeX Site|http://www.miktex.org/]]
[[The Comprehensive TeX Network (CTAN)|http://www.ctan.org/]]
!!LaTeX Editors
There are several editors that make composing LaTeX documents easier. [[See also ...|http://www.ctan.org/tex-archive/systems/win32/]] and Wikipedia on [[Comparison of TeX Editors|http://en.wikipedia.org/wiki/Comparison_of_TeX_editors]].
*[[WinEdt|http://www.winedt.com/]] is a standard ~LaTeX editor. It is not free, but one can get a 30 day trial copy.
*[[TeXEd|ftp://ftp.tex.ac.uk/tex-archive/systems/win32/texed/]] is an old free editor which has not been updated since 1998.
**(This is Tex for Windows 3.2 which is in the computer lab - See also the [[CTAN site|http://www.ctan.org/tex-archive/systems/win32/texed/]].)
*[[TeXnicCenter|http://sourceforge.net/projects/texniccenter/]] is another free editor that ties into ~MiKTeX.
** Students in the past liked this editor. Install ~MikTeX first and then select to use ~MikTeX in editor installation.
*[[LyX|http://www.lyx.org/]] is a free WYSIWYG word processor supporting the ~MiKTeX installation.
*Other Free Editors:
**[[TeXShell|http://www.projectory.de/texshell/]]
**[[Crimson Editor|http://www.crimsoneditor.com/]]
**[[Texmaker|http://www.xm1math.net/texmaker/]]
**[[AUCTeX|http://www.gnu.org/software/auctex/]]
**[[TeXworks|http://www.tug.org/texworks/]]
For online editing see [[Live Previews]] and [[Online LaTeX Viewers]].
!!Steps to Producing a Paper
# Write LaTeX File and save with .tex extension.
# Compile ~pdfLaTeX to produce a pdf file
# Make corrections and additions and repeat last steps until tex file is error-free.
!! Starting the LaTeX File
We will go through the steps for producing the skeleton of an article. Look at this [[Example]] and its [[PDF|GeneralLaTeXExample.pdf]] for a few tips on getting started as you read through these steps. You can view this [[sample]] ([[PDF|sample.pdf]]) as well for a different take.
[[Setting up Documentstyle]]
[[Title and Author]]
[[Abstract]]
[[Sectioning]]
[[Theorems]]
[[Citations]]
A simpler sample is [[here|http://people.uncw.edu/hermanr/latex/samplepaper.tex]], but you need this [[figure|http://people.uncw.edu/hermanr/latex/triangle1.jpg]].
!!~How-To Produce Scientific Documents
[[LaTeX by Example|http://pangea.stanford.edu/computerinfo/unix/formatting/latexexample.html]]
[[sample2e.tex|http://plastex.sourceforge.net/sample2e/sample2e.txt]]
[[Getting Started with LaTeX|http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Index.html]] by David R. Wilkins
@@[[Template]] for MAT 495 Project@@
!! Papers using Postscript
If using LaTeX and ps or eps files then
# Write LaTeX File and save with .tex extension.
# Compile LaTeX to produce a dvi file
# View dvi file with YAP (Yet Another Previewer)
# Print dvi file or
## Convert dvi to PDF and print the PDF (portable document file).
## Convert dvi to PS and print the PS (postscript) file via Ghostview.
## Convert dvi to PS, PS to PDF and print PDF. This is sometimes needed with postscript images.
Note - One can now use eps files with ~pdfLaTeX using the package [[epstopdf|http://www.ctan.org/pkg/epstopdf]]. See [[How to convert eps to pdf|http://www.techntechie.com/how-to-convert-eps-to-pdf-in-latex.html]].
Special formatting commands that are not built into LaTeX may be needed. Here are some common style files. You can download these to your thesis folder. The LaTeX Editor should be able to find them.
[[setspace.sty|StyleFiles/setspace.sty]]
[[graphics.sty|StyleFiles/graphics.sty]]
[[graphicx.sty|StyleFiles/graphicx.sty]]
[[keyval.sty|StyleFiles/keyval.sty]]
[[trig.sty|StyleFiles/trig.sty]]
[[ctl3dv2.dll|StyleFiles/ctl3dv2.dll]]
/*{{{*/
/* Modied Style from Julian Knight JK Version: 2006-04-20 (Simplified) */
body {position:static;}
.tagClear {margin-top:1em;clear:both;}
hr {height:0px;border:0;border-top:1px solid silver;}
h1,h2,h3,h4,h5 {color:#014;background:transparent;border-bottom:1px solid #ddd;padding-left:0;}
.headerShadow {padding:.5em 0em .5em 1em;}
.headerForeground {padding:.5em 0em .5em 1em;}
#displayArea { /* The bit that contains all tiddlers */
padding-top:.1em;padding-bottom:.1em;
margin-top:0;margin-right:15.5em;margin-bottom:0;margin-left:12.5em;-moz-border-radius:1em;}
.tiddler {-moz-border-radius:1em;border-top:1px solid #ccc;border-left:1px solid #ccc;
border-bottom:3px solid #ccc;border-right:3px solid #ccc;margin:0.5em;background:#fff;padding:0.5em;}
.subtitle { /* Tiddler subtitle */
font-size:0.9em;text-align:right;}
.viewer pre {padding: 0;margin-left: 0;}
.viewer hr {border: solid 1px silver;}
.toolbar {visibility:visible;}
.selected .toolbar {visibility:visible;color:#00f;}
.toolbar .button { color:#dee; }
.selected .toolbar .button { color:#014;}
.tagging, .tagged, .selected .tagging, .selected .tagged {
font-size:75%; padding:0.3em; background-color:#eee;border-top:1px solid #ccc; border-left:1px solid #ccc;
border-bottom:3px solid #ccc; border-right:3px solid #ccc;max-width:45%;-moz-border-radius:1em;}
.noBorder,.noBorder td,.noBorder th,.noBorder tr{border:0 !important}
.evenRow{} .oddRow{}
.headerShadow { visibility: hidden; }
#sidebar{display:none;}
#displayArea {margin: 1em 1em 0em 14em;}
.smaller { font-size:80%; }
.small { font-size:90%; }
/* Added Color Style*/
.header {background: #990000;}
.header {foreground: #000000;}
.title {color: #990000;}
.subtitle {color: #990000;}
.toolbar {color: #990000;}
/*}}}*/
.viewer {
line-height: 125%;
font-family: serif;
font-size: 10pt;
}
* StyleSheet
* StyleSheetColors
* StyleSheetLayout
* StyleSheetPrint
|>|>|!PageTemplate|
|>|>|[[SiteTitle]] - [[SiteSubtitle]]|
|>|>|TopMenu|
|[[MainMenu]]|[[DefaultTiddlers]]<<br>><<br>>[[ViewTemplate]]<<br>><<br>>[[EditTemplate]]|[[SideBarOptions]]|
|~|~|[[OptionsPanel]]<<br>>AdvancedOptions|
|~|~|SideBarTabs|
|>|>|[[SiteUrl]]|
* SideBarOptions
* SideBarTabs
* TabAll
* TabMore
* TabMoreMissing
* TabMoreOrphans
* TabTags
* TabTimeline
* DefaultTiddlers
* MainMenu
* SiteSubtitle
* SiteTitle
* SiteUrl
Tables can be produced several ways. The most common is provided by the following:
{{{
\begin{table}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
$p$ & $n=0$ & $n=1$ & $n=2$ & $n=3$ & $n=4$ & $n=5$ \\
\hline
1 & 2.405 & 3.832 & 5.135 & 6.379 & 7.586 & 8.780 \\
2 & 5.520 & 7.016 & 8.147 & 9.760 & 11.064 & 12.339 \\
3 & 8.654 & 10.173 & 11.620 & 13.017 & 14.373 & 15.700 \\
\hline
\end{tabular}
\caption{The zeros of Bessel Functions}
\label{bjs}
\end{center}
\end{table}
}}}
More information about formatting tables can be found [[here|http://www.andy-roberts.net/misc/latex/latextutorial4.html]].
Here is a sample proposal written in LaTeX. [[PDF|http://people.uncw.edu/hermanr/mat495/project-proposal-template.pdf]], [[LaTeX file|http://people.uncw.edu/hermanr/mat495/project-proposal-template.tex]],
{{{
%%%% Template for Seminar Project Proposal
\documentclass[letterpaper,10pt]{article}
%% set page geometry
\pdfpagewidth 8.5in
\pdfpageheight 11in
\setlength\topmargin{0in}
\setlength\headheight{0in}
\setlength\headsep{0in}
\setlength\textheight{8in}
\setlength\textwidth{6.5in}
\setlength\oddsidemargin{0in}
\setlength\evensidemargin{0in}
\setlength\parindent{0.25in}
\setlength\parskip{0.1in}
%% load needed packages
\usepackage{amsmath,amsthm,amsfonts,graphicx}
%% define header information
\def\semester{Spring 2013}
\def\project_topic{On the Electrodynamics of Moving Bodies}
\def\student_investigator{Albert Einstein}
\def\faculty_advisor{Dr. R. L. Herman}
\begin{document}
%\vspace*{-1in}
\noindent MAT 495. Seminar in Mathematics \hfill Project Proposal \\
\noindent UNCW Mathematics and Statistics \hfill \semester \par
\begin{center}
{\LARGE \textbf{ \project_topic } \par}
\bigskip
{\large Student Investigator: \student_investigator} \\
\bigskip
{\large Faculty Advisor: \faculty_advisor}
\end{center}
\thispagestyle{empty}
\section*{Motivation}
Since I was very young, I have always been fascinated with light. I thought about what would happen to my reflection in a mirror as I moved close to the speed of light. Would I see my reflection? What does Maxwell's theory of electromagnetic waves predict?
\section*{Literature Review}
This investigation will be based on the works of James Clerk Maxwell \cite{maxwell} and Isaac Newton \cite{newton}. In \cite{maxwell} Maxwell introduces the equations of electricity and magnetism in one complete theory. Newton had already presented in his {\it Principia} the laws of classical motion and gravitation \cite{newton}.
\section*{Problem to be Addressed}
In this project I will reconcile Maxwell's equations for electricity and magnetism with the laws of mechanics by introducing major changes to mechanics close to the speed of light.
%%% Enter your bibliography following the examples shown here.
\begin{thebibliography}{99}%% The 99 gives the width of the label
\bibitem{newton} I. Newton,
\emph{Philosophiae Naturalis Principia Mathematica},
New York: Viking,
1958.
\bibitem{maxwell} J. C. Maxwell,
\emph{A Dynamical Theory of the Electromagnetic Field},
Philosophical Transactions of the Royal Society of London,
155 (1865) pp. 459�512 .
\end{thebibliography}
\end{document}
}}}
Here one can test some LaTeX commands. Click the edit (on local version of this document.) Edit the following:
$$\int\frac{dx}{\sqrt{1-x^2}}$$
There are several ways to introduce theorems and proofs into your papers. Here is one method:
{{{
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}
\begin{document}
\begin{definition}
Let A be a set.
\end{definition}
\begin{theorem}
Let A be a set.
\end{theorem}
\begin{proof}
Now prove something.
\end{proof}
\end{document}
}}}
More information can be found at the following sites.
[[AMS-LaTeX|http://www.stat.umn.edu/~charlie/amslatex.html]]
[[Using the amsthm package|ftp://ftp.ams.org/pub/tex/doc/amscls/amsthdoc.pdf]]
Next: [[Citations]]
You will next want to set up the title and eneter your name. So far you should have
{{{
\documentclass{article}
\begin{document}
\end{document}
}}}
The title and author are specified after the documentclass statement and before the \begin{document} statement. This area is often referred to as the ''Preamble''. The commands needed are
{{{
\title{This is My First Article}
\author{Your Name}
}}}
If you were to compile the code, you would get no pages of output. This is because you have not put in an instruction to create the title and author. This is done by typing
{{{
\maketitle
}}}
in the document section. Thus, you should now have the following:
{{{
\documentclass{article}
\title{This is My First Article}
\author{Your Name}
\begin{document}
\maketitle
\end{document}
}}}
Running this code will produce one page with the title, author and date. The date provided is the current date. You can change this by adding a date command after the author:
{{{
\date{September 10, 2006}
}}}
You can also suppress the date with
{{{
\date{ }
}}}
You can view your article so far by following the steps: (or just use ~pdfLaTeX)
# Run LaTeX
# Run dvi Previewer
Next: [[Abstract]]
Now that you have the pages laid out, you can start typing your paper. The beauty of LaTeX is that you can typeset mathematical expressions and equations. When you preview your paper, you will see the difference in using LaTeX vs a regular text editor or MS Word. You can use [[Live Previews]] to test typesetting expressions.
Mathematical expressions can be entered in a sentence, or displayed alone on a line. Equations can also be numbered. LaTeX automatically does the numbering. So, if you insert a new equation, you will not have to worry about renumbering.
Entering text inline requires that the expression be typed in between two dollar signs like {{{$x^2$}}}. This will produce $x^2$. [''Note:'' All rendering of LaTeX in this LaTeX Introduction is being done using [[MathJax|http://www.mathjax.org/]] as a test and might not render exactly as you would see in your papers. Sometimes enlarging the text display makes the page clearer.]
You can produce the equation x^2+2x-1 = 0 on a separate line by typing {{{$$x^2+2x-1 = 0$$}}}. This produces, $$x^2+2x-1 = 0$$
A numbered equation can be obtained using the equation environment. Type the following into your document and compile it.
{{{
\begin{equation}
x^2+2x-1 = 0
\end{equation}
}}}
If you want to reference an equation, then you need to give it a unique label and reference the label:
{{{
\begin{equation}
x^2+2x-1 = 0
\label{myEqn}
\end{equation}
}}}
Then you can refer to it in your paragraph using the ref command
{{{
... and we can see in Equation \ref{myEqn} that ...
}}}
The one caution you should know about is that you have to run LaTeX two times to get the equation numbers correct. The first time it is compiled LaTeX creates and aux file where equation numbers and other counters are stored. The second time it is run LaTeX reads the aux file to correctly insert all label references. This is especially important if the reference occurs before the label is defined.
Note: You can change the text size of this page to view the rendered expressions if they are not clear.
There are many commands that you will need to know in order to typeset the mathematical expressions correctly.
For example, {{{$\sin x$}}} produces $\sin x$.
Also fractions are entered as {{{$\frac{x^2}{3}$}}} to produce $\frac{x^2}{3}$.
Subscripts are entered as {{{$x_1$}}} to give $x_1$.
Of course, you can produce much fancier expressions: {{{$$\int_0^{\pi} \frac{e^{-x}}{1+x^2} \, dx $$ }}} for $$\int_0^{\pi} \frac{e^{-x}}{1+x^2} \, dx $$ and you can type your favorite Greek letters {{{$\alpha$}}}: $\alpha$.
For more symbols see [[LaTeX Math Symbols]].
!Examples (Originally from jsMath)
|!Source|!Output|h
|{{{The variable $x$ is real.}}}|The variable $x$ is real.|
|{{{The variable \(y\) is complex.}}}|The variable \(y\) is complex.|
|{{{This \[\int_a^b x = \frac{1}{2}(b^2-a^2)\] is an easy integral.}}}|This \[\int_a^b x = \frac{1}{2}(b^2-a^2)\] is an easy integral.|
|{{{This $$\int_a^b \sin x = -(\cos b - \cos a)$$ is another easy integral.}}}|This $$\int_a^b \sin x = -(\cos b - \cos a)$$ is another easy integral.|
|{{{Block formatted equations may also use the 'equation' environment \begin{equation} \int \tan x = -\ln \cos x \end{equation} }}}|Block formatted equations may also use the 'equation' environment \begin{equation} \int \tan x = -\ln \cos x \end{equation}|
|{{{Equation arrays are also supported \begin{eqnarray} a &=& b \\ c &=& d \end{eqnarray} }}}|Equation arrays are also supported \begin{eqnarray} a &=& b \\ c &=& d \end{eqnarray} |
|{{{I spent \$7.38 on lunch.}}}|I spent $7.38 on lunch.|
|{{{I had to insert a backslash (\\) into my document}}}|I had to insert a backslash ( \ ) into my document|
This site and the UNCW Thesis Format are provided by [[Dr. Herman|http://people.uncw.edu/hermanr]]. If you have any problems with the formatting of your thesis, feel free to contact Dr. Herman at [[hermanr@uncw.edu|mailto:hermanr@uncw.edu]]. For problems with general formatting in LaTeX see your advisor or Dr. Herman. This site is also designed to assist MAT 495 students in learning to use LaTeX for writing papers and doing presentations in mathematics using LaTeX.
<div>
<span class='title' style='float:left;' macro='view title'></span>
<span style='float:right;' class='subtitle'>
<span macro='view modifier link'></span>,
<span macro='view modified date [[DD MMM YYYY]]'></span>
(created <span macro='view created date [[DD MMM YYYY]]'></span>)
</span>
<span class='toolbar' style='clear:right;margin-top:1px;float:right;'
macro='toolbar -closeTiddler +editTiddler deleteTiddler closeOthers permalink references jump'>
</span>
<div class='tagClear'></div>
</div>
<hr>
<div class='tagClear viewer' macro='view text wikified'></div>
In this section are listed some resources on writing mathematics papers and presenting mathematics talks.
!!How to Write Mathematics Papers
*[[Halmos on Writing Mathematics|http://www.stat.rice.edu/~riedi/HalmosWrite.rtf]]
*[[A Few Tips on How to Write Mathematics|http://www.math.ups.edu/~bryans/Current/PDF/MTHWRT97.PDF#search=%22how%20to%20write%20mathematics%22]]
*[[Writing a Research Paper in Mathematics|http://web.mit.edu/jrickert/www/mathadvice.html]]
*[[Write Right for Readers|http://www.maths.adelaide.edu.au/anthony.roberts/LaTeX/ltxwrite.php]]
!!Mathematics Presentations
*[[Mathematical Communication and Technology|http://www.math.tamu.edu/~Harold.Boas/courses/math696/index.html]]
<html><iframe src="http://plastex.sourceforge.net/sample2e/sample2e.txt" style="width:100%;height:400px"></iframe></html>
{{{http://plastex.sourceforge.net/sample2e/sample2e.txt}}}