Help:Displaying a formula: Difference between revisions
Content deleted Content added
Caleb Cooper (talk | contribs) |
Caleb Cooper (talk | contribs) No edit summary |
||
Line 1,434:
Also note that if you rely on this workaround, if/when the rendering on the server gets fixed in future releases, as a result of this extra manual offset your formulae will suddenly be aligned incorrectly. So use it sparingly, if at all.
==
===1 step method ===
<math>
\begin{array}{lcl}
& X & \overset{f}\rightarrow & Z & \\
& g \downarrow && \downarrow g'\\
& Y & \underset{f'}\rightarrow & W & \\
\end{array}
</math>
<syntaxhighlight lang="tex"><math>
\begin{array}{lcl}
& X & \overset{f}\rightarrow & Z & \\
& g \downarrow && \downarrow g'\\
& Y & \underset{f'}\rightarrow & W & \\
\end{array}
</math></syntaxhighlight>
===3 step method ===
[[File:First isomorphism theorem (plain).svg|thumb|A sample commutative diagram, created in the manner described]]
To make a [[commutative diagram]], there are three steps:
# write the diagram in [[TeX]]
# [[#Convert to SVG|convert to SVG]]
# [[commons:Commons:First steps/Upload form|upload the file]] to [[commons:|Wikimedia Commons]]
===
[http://www.tug.org/applications/Xy-pic/ Xy-pic]{{efn|Use the barr option for commutative diagrams, e.g., <code>\usepackage[cmtip,all,barr]{xy}</code>.}} ([http://tex.loria.fr/graph-pack/doc-xypic/xyguide-html/xyguide-html.html online manual]) is the most powerful and general-purpose diagram package in [[TeX]]. Diagrams created using it can be found at [[commons:Category:Xy-pic diagrams|Commons: Category:Xy-pic diagrams]].
Simpler packages include:
*[[American Mathematical Society|AMS's]] [http://www.dante.de/CTAN//help/Catalogue/entries/amscd.html amscd]
*Paul Taylor's [http://www.ctan.org/tex-archive/macros/generic/diagrams/taylor/ diagrams]
*François Borceux [http://www.ctan.org/tex-archive/help/Catalogue/entries/borceux.html Diagrams]
The following is a template for Xy-pic:
<syntaxhighlight lang=latex>
\documentclass[border=10pt]{standalone} % Crop to size, remove page numbers, leave margin
\usepackage[all]{
\begin{document}
\SelectTips{eu}{} % Euler (shorter) arrowheads (tips)
$$
\xymatrix{
%%% Diagram goes here %%%
}
$$
\end{document}
</syntaxhighlight>
Using postscript drivers may in some cases give smoother curves and will handle fonts differently:
<syntaxhighlight lang=latex>\usepackage[all, ps, dvips]{xy}</syntaxhighlight>
====Convert to SVG====
Once you have produced your diagram in LaTeX (or TeX), you can convert it to an SVG file using the following sequence of commands:
<syntaxhighlight lang=bash>
pdflatex file.tex
</syntaxhighlight>
The [http://pdfcrop.sourceforge.net pdfcrop] and [http://www.cityinthesky.co.uk/opensource/pdf2svg pdf2svg] utilities are needed for this procedure. You can alternatively use [http://www.pdftron.com/pdf2svg/ pdf2svg] from PDFTron for the last step.
If you do not have [[pdfTeX]] (which is unlikely) you can use the following commands to replace the first step (TeX → PDF):
<syntaxhighlight lang=bash>
latex file.tex
dvipdfm file.dvi
</syntaxhighlight>
In general, you will not be able to get anywhere with diagrams without TeX and Ghostscript, and the <syntaxhighlight lang="latex" inline>inkscape</syntaxhighlight> program is a useful tool for creating or modifying your diagrams by hand. There is also a utility <syntaxhighlight lang="latex" inline>pstoedit</syntaxhighlight> which supports direct conversion from Postscript files to many vector graphics formats, but it requires a non-free plugin to convert to SVG, and regardless of the format, [[User:Ryan Reich|this editor]] has not been successful in using it to convert diagrams with diagonal arrows from TeX-created files.
These programs are:
*a working TeX distribution, such as [[TeX Live]]
*[[Ghostscript]]
*[[pstoedit]]
*[[Inkscape]]
====Upload the file====
{{See also|commons:Commons:First steps/Upload form}}
{{See also|Help:Contents/Images and media}}
As the diagram is your own work, upload it to [[commons:|Wikimedia Commons]], so that all projects (notably, all languages) can use it without having to copy it to their language's Wiki. (If you've previously uploaded a file to somewhere other than Commons, to Commons.)
; Check size: Before uploading, check that the default size of the image is neither too large nor too small by opening in an [[SVG#Support in applications|SVG application]] and viewing at default size (100% scaling), otherwise adjust the <
; Name: Make sure the file has a [[
; Upload: [[commons:Special:Userlogin|Login to Wikimedia Commons]], then <span class="plainlinks">[http://commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=ownwork upload the file]</span>; for the '''Summary''', give a brief description.
Now go to the [[Help:Image page|image page]] and add a [[commons:Commons:First steps/Quality and description#Good file descriptions|description]], including the '''source code''', using this template:
<pre>
{{Information
|description =
{{en|1= '''Description [[:en:Link to WP page|topic]]'''}}
|
[[:en:Help:Displaying a formula#Commutative diagrams]];
source code below.
|date = '''The Creation Date, like 1999-12-31'''
|author = '''[[User:YourUserName|Your Real Name]]'''
|permission = {{self|PD-self '''(or [[commons:Licensing#Well-known licenses|other license]])'''
|author = '''[[User:YourUserName|Your Real Name]]'''}}
}}
====TeX source====
<syntaxhighlight lang="latex">
% TeX source here
</syntaxhighlight>
[[Category:Commutative diagrams]]
[[Category:Xy-pic diagrams]]
</pre>
; Source code
:*Include the source code in the [[Help:Image page|image page]], in the {{mono|Source}} section of the <code><nowiki>{{</nowiki>[[commons:Template:Information|Information]]}}</code> template, so that the diagram can be edited in future.
:*Include the complete <code>.tex</code> file, not just the fragment, so future editors do not need to reconstruct a compilable file.
:*You may optionally make the source code section collapsible, using the <code><nowiki>{{</nowiki>[[commons:Template:cot|cot]]}}</code> or <code><nowiki>{{</nowiki>[[commons:Template:cob|cob]]}}</code> templates.
:*(Don't include it in the Summary section, which is just supposed to be a summary.)
; License
: The most common license for commutative diagrams is <code>[[commons:Template:PD-self|PD-self]]</code>; some use <code>[[commons:Template:PD-self|PD-ineligible]]</code>, especially for simple diagrams, or other licenses. Please ''do not'' use the [http://www.gnu.org/copyleft/fdl.html GFDL], as it requires the entire text of the GFDL to be attached to any document that uses the diagram.
; Description
: If possible, link to a Wikipedia page relevant to the diagram. (The <code>1=</code> is necessary if you use nest templates within the description, and harmless otherwise.)
; Category
: Include <code><nowiki>[[Category:Commutative diagrams]]</nowiki></code>, so that it appears in [[commons:Category:Commutative diagrams]]. There are also subcategories, which you may choose to use.
; Include image
: Now include the image on the original page via <code><nowiki>[[File:Diagram.svg]]</nowiki></code>
====Examples====
A sample conforming diagram is [[commons:File:PSU-PU.svg]].
==Chemistry==
| |||