Help:Reference card/TeX source

From Meta, a Wikimedia project coordination wiki
% Reference Card for Wiki syntax (MediaWiki)
% To create a document out of this for printing, save this text into
% a file 'wiki-refcard.tex' and run the commands
%     tex wiki-refcard.tex
%     dvips -t landscape wiki-refcard.dvi -o
%     gs -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile=wiki-refcard.pdf wiki-refcard.ps
% this will result in a PDF file 'wiki-refcard.pdf'
% this is a comment

%**start of header
\newcount\columnsperpage
\overfullrule=0pt

% This file can be printed with 1, 2, or 3 columns per page (see below).
% [For 2 or 3 columns, you'll need 6 and 8 point fonts.]
% Specify how many you want here.  Nothing else needs to be changed.

\columnsperpage=3

% This reference card is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

% This file is intended to be processed by plain TeX (TeX82).
%
% The final reference card has six columns, three on each side.
% This file can be used to produce it in any of three ways:
% 1 column per page
%    produces six separate pages, each of which needs to be reduced to 80%.
%    This gives the best resolution.
% 2 columns per page
%    produces three already-reduced pages.
%    You will still need to cut and paste.
% 3 columns per page
%    produces two pages which must be printed sideways to make a
%    ready-to-use 8.5 x 11 inch reference card.
%    For this you need a dvi device driver that can print landscape
% Which mode to use is controlled by setting \columnsperpage above.

%
% Thanks:
%  (reference card macros due to Stephen Gildea)

\def\versionnumber{0.99}  % Version of this reference card
\def\year{2006}
\def\month{Apr}
\def\version{\month\ \year\ v\versionnumber}

\def\shortcopyrightnotice{\vskip .5ex plus 2 fill
  \centerline{\small \copyright\ \year\ v\versionnumber}}

\def\copyrightnotice{\vskip 1ex plus 100 fill\begingroup\small
\centerline{\version.}
\endgroup}

% make \bye not \outer so that the \def\bye in the \else clause below
% can be scanned without complaint.
\def\bye{\par\vfill\supereject\end}

\newdimen\intercolumnskip
\newbox\columna
\newbox\columnb

\def\ncolumns{\the\columnsperpage}

\message{[\ncolumns\space 
  column\if 1\ncolumns\else s\fi\space per page]}

\def\scaledmag#1{ scaled \magstep #1}

% This multi-way format was designed by Stephen Gildea
% October 1986.
\if 1\ncolumns
  \hsize 4in
  \vsize 10in
  \voffset -.7in
  \font\titlefont=\fontname\tenbf \scaledmag3
  \font\headingfont=\fontname\tenbf \scaledmag2
		\font\headingfonttt=\fontname\tentt \scaledmag2
  \font\smallfont=\fontname\sevenrm
  \font\smallsy=\fontname\sevensy

  \footline{\hss\folio\hss}
  \def\makefootline{\baselineskip10pt\hsize4in\line{\the\footline}}
\else
  \hsize 3.2in
  \vsize 7.5in %% was 7.95in
  \hoffset -2mm % was -.75in
  \voffset -.745in
  \font\titlefont=cmbx10 \scaledmag2
  \font\headingfont=cmbx10 \scaledmag1
  \font\headingfonttt=cmtt10 \scaledmag1
  \font\smallfont=cmr6
  \font\smallsy=cmsy6
  \font\eightrm=cmr8
  \font\eightbf=cmbx8
  \font\eightit=cmti8
  \font\eighttt=cmtt8
  \font\eightsy=cmsy8
  \font\eightsl=cmsl8
  \font\eighti=cmmi8
  \font\eightex=cmex10 at 8pt
  \textfont0=\eightrm  
  \textfont1=\eighti
  \textfont2=\eightsy
  \textfont3=\eightex
  \def\rm{\fam0 \eightrm}
  \def\bf{\eightbf}
  \def\it{\eightit}
  \def\tt{\eighttt}
  \def\sl{\eightsl}
  \normalbaselineskip=.8\normalbaselineskip
  \normallineskip=.8\normallineskip
  \normallineskiplimit=.8\normallineskiplimit
  \normalbaselines\rm		%make definitions take effect

  \if 2\ncolumns
    \let\maxcolumn=b
    \footline{\hss\rm\folio\hss}
    \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
  \else \if 3\ncolumns
    \let\maxcolumn=c
    \nopagenumbers
  \else
    \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
    \errmessage{Illegal number of columns per page}
  \fi\fi

  \intercolumnskip=.46in
  \def\abc{a}
  \output={%
      % This next line is useful when designing the layout.
      %\immediate\write16{Column \folio\abc\space starts with \firstmark}
      \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
      \else\if a\abc
	\global\setbox\columna\columnbox \global\def\abc{b}
        %% in case we never use \columnb (two-column mode)
        \global\setbox\columnb\hbox to -\intercolumnskip{}
      \else
	\global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
  \def\multicolumnformat{\shipout\vbox{\makeheadline
      \hbox{\box\columna\hskip\intercolumnskip
        \box\columnb\hskip\intercolumnskip\columnbox}
      \makefootline}\advancepageno}
  \def\columnbox{\leftline{\pagebody}}

  \def\bye{\par\vfill\supereject
    \if a\abc \else\null\vfill\eject\fi
    \if a\abc \else\null\vfill\eject\fi
    \end}  
\fi

% we won't be using math mode much, so redefine some of the characters
% we might want to talk about
%\catcode`\^=12
%\catcode`\_=12
\catcode`\~=12

\chardef\\=`\\
\chardef\{=`\{
\chardef\}=`\}
\chardef\underscore=`\_
\chardef\'="0D % These are upright quote marks


\hyphenation{}

\parindent 0pt
\parskip .85ex plus .35ex minus .5ex

\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}

\outer\def\newcolumn{\vfill\eject}

\outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}

\outer\def\section#1{\par\filbreak
  \vskip .5ex  minus .1ex {\headingfont #1}\mark{#1}%
  \vskip .3ex  minus .1ex}

\outer\def\librarysection#1#2{\par\filbreak
  \vskip .5ex  minus .1ex {\headingfont #1}\quad{\headingfonttt<#2>}\mark{#1}%
  \vskip .3ex  minus .1ex}


\newdimen\keyindent

\def\beginindentedkeys{\keyindent=1em}
\def\endindentedkeys{\keyindent=0em}
\def\begindoubleindentedkeys{\keyindent=2em}
\def\enddoubleindentedkeys{\keyindent=1em}
\endindentedkeys

\def\paralign{\vskip\parskip\halign}

\def\<#1>{$\langle${\rm #1}$\rangle$}

\def\kbd#1{{\tt#1}\null}	%\null so not an abbrev even if period follows

\def\beginexample{\par\vskip1\jot
\hrule width.5\hsize
\vskip1\jot
\begingroup\parindent=2em
  \obeylines\obeyspaces\parskip0pt\tt}
{\obeyspaces\global\let =\ }
\def\endexample{\endgroup}

\def\Example{\qquad{\sl Example\/}.\enspace\ignorespaces}

\def\key#1#2{\leavevmode\hbox to \hsize{\vtop
  {\hsize=.75\hsize\rightskip=1em
  \hskip\keyindent\relax#1}\kbd{#2}\hfil}}

\newbox\metaxbox
\setbox\metaxbox\hbox{\kbd{M-x }}
\newdimen\metaxwidth
\metaxwidth=\wd\metaxbox

\def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
  {\hskip\keyindent\relax#1\hfil}%
  \hskip -\metaxwidth minus 1fil
  \kbd{#2}\hfil}}

\def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
  &\kbd{#3}\quad\cr}


%**end of header

\title{MediaWiki Reference Card}

\section{Starting a new page}
{\bf from an existing page:} Add a link to a new
(not yet existing) page and save the document. All pages
that do not yet exist will have a red hyperlink. To 
create that page, click on the red hyperlink. See below
for link syntax.

{\bf from MS Word document:} Go to {\tt http://www.infpro.com\-/Word2MediaWiki.aspx} and follow the instructions there. Note that images
will not be converted.

\section{Basic Formatting}
\metax{'{}'emphasized text'{}'}{2 single quotes}
\metax{'{}'{}'very emphasized text'{}'{}'}{3 single quotes}
\metax{'{}'{}'{}'{}'very very emphasized text'{}'{}'{}'{}'}{5 single quotes}
\metax{empty line}{Paragraph}
\metax{\~{ }\~{ }\~{ }\~{ }}{Insert username and date}
\metax{Start line with a space to avoid reformatting}{}
\metax{$<$nowiki$>$text w/o wikification$<$/nowiki$>$}{in box}
\metax{$<$pre$>$block of text w/o reformatting$<$/pre$>$}{\ \ \ in box}

\section{Headings}
\metax{==Section==}{}
\metax{===Subsection===}{}
\metax{====Subsubsection====}{}

\section{Lists}
\metax{* itemized list}{List with dots}
\metax{** second level}{}
\metax{*** third level}{}
\metax{\# numbered list}{Numbered list}
\metax{\#\# second level}{}
\metax{\#\#\# third level}{}
\metax{; DNA: Deoxyribonucleic acid}{Definition list}
\metax{;; rDNA: Ribosomal DNA}{}
\metax{: colon indents line}{}
\metax{:: more indented line}{}
\metax{-{}-{}-{}-}{horizontal line}

\section{Links}
\metax{we reserach [[rice]] here}{Internal link}
\metax{we research [[Golden Rice]] here}{}
Note: Links to pages that don't exist, will be in red. To create that 
page, simply click on that link to create it. An edit window will appear.\par

\metax{[[Rice$\vert$Oryza sativa]] is\dots}{Alternative text}
\metax{[http://www.yahoo.com Yahoo!!]}{External link}
\metax{see also [http://www.yahoo.com]}{see also [1]$\nearrow$}
\metax{other wiki [[:Wikipedia:PCR$\vert$PCR]]}{Interwiki link}
\metax{\#REDIRECT [[Official position]]}{abbrevs, aliases}
\metax{$\rightarrow$ full details at}{Help:Editing}

\section{Multimedia}
\metax{Here is a pic [[Image:wiki.png]]}{}
\metax{[[Image:wiki.png$\vert$frame$\vert$Caption]]}{with frame}
\metax{[[Image:wiki.png$\vert$thumb$\vert$Caption]]}{with thumb}
\metax{[[Image:wiki.png$\vert$thumb$\vert$300px$\vert$Caption]]}{300px wide}
\metax{[[Image:wiki.png$\vert$thumb$\vert$left$\vert$300px$\vert$Cap]]}{text floating}
\metax{All other media: [[Media:video.asf$\vert$Video]]}{}
\metax{PDF: [[Media:filename.pdf$\vert$PDF]]}{}
\metax{$\rightarrow$ full details at}{Wikimedia:Extended\_image\_syntax}
\metax{$\rightarrow$}{Help:Images\_and\_media}

\section{Tables}
\metax{$\{\vert$}{Simple 3x3 table}
\metax{$\vert$ topleft $\vert\vert$ topmiddle $\vert\vert$ topright}{}
\metax{$\vert$-}{new row}
\metax{midleft $\vert\vert$ midmiddle $\vert\vert$ midright}{3 cells of row 2}
\metax{$\vert$-}{new row}
\metax{bottomleft $\vert\vert$ bottommiddle $\vert\vert$ bottomright}{3 cells of row 3}
\metax{$\vert\}$}{end of table}
%
\metax{\phantom{x}}{ }
%
\metax{$\{\vert$ border=1}{Start framed table}
\metax{$\vert$+ Student List}{caption}
\metax{$\vert$- bgcolor=grey}{first row has grey background}
\metax{! Name !! Age !! Sex}{header}
\metax{$\vert$-}{new row, no parameters}
\metax{$\vert$ Peter $\vert\vert$ align=right $\vert$ 8 $\vert\vert$ m}{3 cells of 1st row}
\metax{$\vert$-}{new row, no parameters}
\metax{$\vert$ Paul $\vert\vert$ align=right $\vert$ 12 $\vert\vert$ m}{3 cells of 2nd row}
\metax{$\vert$-}{new row, no parameters}
\metax{$\vert$ Mary $\vert\vert$ align=right $\vert$ 9 $\vert\vert$ f}{3 cells of 3rd row}
\metax{$\vert\}$}{end}

\metax{$\rightarrow$ full details at}{Help:Table}


\section{Categories}

\metax{[[Category:CatName]]}{Add cat to article}
\metax{Note: new categories are created automatically}{ }
\metax{[[:Category:CatName]]}{Link to cat}
\metax{[[Category:People$\vert$Einstein, Albert]]}{Sort under Einstein}
Categories can be member of other categories. This
way you create a hierachy of categories.\par
\metax{Special:Categories}{Lists all categories}
\metax{Note: Images can be part of a category}{}
\metax{$\rightarrow$ full details at}{Help:Category}

\section{Math}
$<$math$>\backslash$ sum\_$\{$n=0$\}\hat{ } \backslash\hbox{infty}\backslash$frac$\{$x\^{ }n$\}\{$n!$\}<$/math$>$\par

\metax{$\displaystyle \sum_{n=0}^\infty {x^n\over n!}$}{La\TeX\ style math}
\metax{$\rightarrow$ full details at}{Help:Math}


\section{Special Characters}
\metax{\`A \&Agrave; \`E \&Egrave; \`o \&ograve; \dots}{accent grave}
\metax{$\acute A$ \&Aacute; $\acute E$ \&Eacute; $\acute o$ \&oacute; \dots}{accent acute}
\metax{\^A \&Acirc; \^E \&Ecirc; \^o \&ocirc; \dots}{accent circumflex}
\metax{\~A \&Atilde; \~N \&Ntilde; \~n \&ntilde; \dots}{tilde}
\metax{\"A \&Auml; \"E \&Euml; \"o \&ouml; \dots}{umlaut}
\metax{$\beta$ \&szlig; \oe\ \&oelig; \o\ \&oslash;}{specials}
\metax{?` \&iquest; !` \&iexcl; $\dagger$ \&dagger; --- \&mdash;}{}
\metax{$\alpha$ \&alpha; $\beta$ \&beta; $\gamma$ \&gamma; \dots}{greek}
\metax{$\rightarrow$ full details at}{Help:Special\_characters}

\section{Templates}

To insert a block of text from a template type $\{\{$Template name$\}\}$.
The template can be found under\par
Template:Template\_name.\par

\metax{$\rightarrow$ full details at}{Help:Template}

\section{Policies}

{\bf Naming articles} The name of the article is at the same time the
article headline as well as the link for the article. The first
character is always automatically capitalized. Lowercase second and
subsequent words, except if it's a name. Prefer singular nouns. Use
spelled-out phrase and use redirect for acronyms and abbreviations.

The following characters are not allowed in page titles: \# + $<$ $>$
[ ] $\vert$ $\{$ $\}$ /. The first character is automatically
capitalized. The maximum length is 255 characters.

\metax{$\rightarrow$ full details at}{Wikipedia:Naming\_conventions}

{\bf Editing} Be bold in updating articles. If you see a mistake,
content, spelling or grammar, please edit the page and correct it
immediately. But don't be reckless. Don't make the contributer
angry.% Stay at a neutral point of view.

Perfection is not required. This is a community and incomplete
articles or random collection of facts. Save them for others to add
their knowledge and edit your article. Avoid duplication, irrelevancy,
nonsense and inaccuracy.

\metax{$\rightarrow$ full details at}{Wikipedia:Wikiquette}

\section{Help Pages}

Help pages mentioned above, are available at\par
{\tt http://en.wikipedia.org/wiki/Help} or under the mentioned help section, e.\
g.\ {\tt http://en.wikipedia.org/wiki/Help:Table}.


%%%%%%%%%%%%%%%%%%%%%%%%%% END LIBRARIES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This goes at the bottom of the last page (column 6)
\copyrightnotice
%

\bye

% Local variables:
% compile-command: "tex wiki-refcard.tex"
% End: