Benutzer:Astronomer/LatTex

Aus PlusPedia
Wechseln zu: Navigation, Suche

This is a script to help convert TeX tags into the correct form for Pluspedia-wiki. At the moment the script doesn't handle the \newcommand environment or figures and certain types of tables. Python is required.

We are actively working on improving the program and we welcome your input. The code is relatively straight forward to modify and you are welcome to add in your own lines to the code and we will use your updated version, or if you have a request you can add these to the discussion page.

One thing to note is that the code looks for the line \begin{document} and only processes the file after this command. What this means is that if you do not have line you will get a blank document.

Caveat Emptor: This code IS NOT PERFECT. The script will do a lot of the leg work, but expect to make some minor modifications after the script has been run.

Coin Übrigens: Die PlusPedia ist NICHT die Wikipedia.
Wir sind ein gemeinnütziger Verein, PlusPedia ist werbefrei. Wir freuen uns daher über eine kleine Spende!

1 Usage

The script is executed using the following syntax:

>python Latex2wiki.py < infile.tex >outfile.wiki

That's really it.

Note that the latex file needs to be of compilable form, especially it needs a \begin{document} as all material before this is ignored.

2 Capabilities

The script will strip the preamble, \author tags etc. The \itemize environment is also recognized and parsed into a wiki list, however custom bullet types are not supported at the moment. The most important replacements made by the script are the following:

LaTeX replacement wikitext
\cite{} ([#References|references])
\emph{ txt } ''txt''
\texit{ txt } ''txt''
\texttt{ txt } =txt=
\textbf{ txt } '''txt'''
\textt{ txt } =txt=
\begin{ equation }(*?) or \[ <center><math>
\end{ equation }(*?) or \] </math></center>
\begin{ eqnarray }(*?) <center><math><\begin{matrix}>
\end{ eqnarray }(*?) <\end{matrix}></math></center>
\begin{ align }(*?) <center><math><\begin{matrix}>
\end{ align }(*?) <\end{matrix}></math></center>
\begin{ aligned }(*?)
\end{ aligned }(*?)
\begin{ subequations }(*?)
\end{ subequations }(*?)
$ <math>or </math>
\begin{verbatim} <br><code>
\end{verbatim} </code><br>
\[..]section appropriate wiki heading level

3 The Script

For security, python scripts cannot be served off of the wiki. Please change the extension for '.txt' to '.py' after downloading.

Latex2wiki.txt

4 References

This script is based heavily on Latex to Wiki on Qwiki which in turn was based on latex2twiki.py.

5 Another Script

Here is another script, written in Perl, which has been inspired by the above script and has more capabilities, e. g. it can resolve macros, respects \newcommand , and can handle simple tabular environments. The script can be run on the command line

>perl latex2wiki.pl infile.tex >outfile.html

Some documentation can be obtained via

>perl latex2wiki.pl -h

The output is HTML which can be viewed in a web browser and then pasted into the wiki. This is for reasons of encodings, because this script can also handle certain umlauts and accents. Alternatively, the script can be run as a CGI script (after uncommenting the CGI part of the script and commenting the command line part). I hope this script will be useful. Here is the script (please rename the file from latex2wiki_perl.txt to latex2wiki.pl after downloading and replace all capital K letters by < and all capital Z letters by >)

Quelle:Handbuch Mediawiki

Diesen Artikel melden!
Verletzt dieser Artikel deine Urheber- oder Persönlichkeitsrechte?
Hast du einen Löschwunsch oder ein anderes Anliegen? Dann nutze bitte unser Kontaktformular

PlusPedia Impressum
Diese Seite mit Freunden teilen:
Mr Wong Digg Delicious Yiggit wikio Twitter
Facebook




Bitte Beachte:
Sämtliche Aussagen auf dieser Seite sind ohne Gewähr.
Für die Richtigkeit der Aussagen übernimmt die Betreiberin keine Verantwortung.
Nach Kenntnissnahme von Fehlern und Rechtsverstößens ist die Betreiberin selbstverständlich bereit,
diese zu beheben.

Verantwortlich für jede einzelne Aussage ist der jeweilige Erstautor dieser Aussage.
Mit dem Ergänzen und Weiterschreiben eines Artikels durch einen anderen Autor
werden die vorhergehenden Aussagen und Inhalte nicht zu eigenen.
Die Weiternutzung und Glaubhaftigkeit der Inhalte ist selbst gegenzurecherchieren.


Typo3 Besucherzähler - Seitwert blog counter
java hosting vpn norway