<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: latex code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 03:24:46 GMT</pubDate>
    <description>DZone Snippets: latex code</description>
    <item>
      <title>Latex2wiki</title>
      <link>http://snippets.dzone.com/posts/show/2847</link>
      <description>Translate a subset of LaTeX into MoinMoin wiki syntax.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env python&lt;br /&gt;&lt;br /&gt;#    Copyright (C) 2003, Maxime Biais &lt;maxime@biais.org&gt;&lt;br /&gt;#&lt;br /&gt;#    This program is free software; you can redistribute it and/or modify&lt;br /&gt;#    it under the terms of the GNU General Public License as published by&lt;br /&gt;#    the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;#    (at your option) any later version.&lt;br /&gt;#&lt;br /&gt;#    This program is distributed in the hope that it will be useful,&lt;br /&gt;#    but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;#    GNU General Public License for more details.&lt;br /&gt;#&lt;br /&gt;#    You should have received a copy of the GNU General Public License&lt;br /&gt;#    along with this program; if not, write to the Free Software&lt;br /&gt;#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA&lt;br /&gt;#&lt;br /&gt;# $Id: latex2wiki.py,v 1.1.1.1 2004/03/14 18:31:50 max Exp $&lt;br /&gt;&lt;br /&gt;import sys, re&lt;br /&gt;&lt;br /&gt;def dummy(d):&lt;br /&gt;    pass&lt;br /&gt;&lt;br /&gt;NONE = "__@NONE@__"&lt;br /&gt;&lt;br /&gt;tr_list = [&lt;br /&gt;    (r"\\includegraphics.*{(.*)\.eps}", "attachment::%s.png", dummy),&lt;br /&gt;    (r"\\caption{.*}", "", dummy),&lt;br /&gt;    (r"\\label{.*}", "", dummy),&lt;br /&gt;    (r"(.*)\\emph{(.*)}(.*)", """%s'''%s'''%s""", dummy),&lt;br /&gt;    (r"\\item (.*)", " * %s", dummy),&lt;br /&gt;    (r"\\begin{.*}", "", dummy),&lt;br /&gt;    (r"\\end{.*}", "", dummy),&lt;br /&gt;    (r"(.*)``(.*)''(.*)", "%s\"%s\"%s", dummy),&lt;br /&gt;    (r"\\chapter{(.*)}", NONE, dummy),&lt;br /&gt;    (r"\\paragraph{(.*)}", "==== %s ====", dummy),&lt;br /&gt;    (r"\\subsubsection{(.*)}", "==== %s ====", dummy),&lt;br /&gt;    (r"\\subsection{(.*)}", "=== %s ===", dummy),&lt;br /&gt;    (r"\\section{(.*)}", "== %s ==", dummy),&lt;br /&gt;    (r"(.*)\\fig{.*}(.*)", "%s suivant %s", dummy)&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;in_stream  = open(sys.argv[1], "r")&lt;br /&gt;if len(sys.argv) &lt; 3:&lt;br /&gt;    out_stream = sys.stdout&lt;br /&gt;else:&lt;br /&gt;    out_stream = open(sys.argv[2], "w")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for i in in_stream.readlines():&lt;br /&gt;    cur_write = 0&lt;br /&gt;    for reg in tr_list:&lt;br /&gt;        m = re.search(reg[0], i)&lt;br /&gt;        if m:&lt;br /&gt;            reg[2](i)&lt;br /&gt;            cur_write = 1&lt;br /&gt;            if reg[1] == NONE:&lt;br /&gt;                break&lt;br /&gt;            print &gt;&gt; out_stream, reg[1] % m.groups()&lt;br /&gt;            break&lt;br /&gt;    if not cur_write:&lt;br /&gt;        out_stream.write(i)&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 17 Oct 2006 12:10:39 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2847</guid>
      <author>bugmenot (BugMeNot)</author>
    </item>
    <item>
      <title>Makefile for latex</title>
      <link>http://snippets.dzone.com/posts/show/1300</link>
      <description>this is a sample makefile to build a latex report with pdflatex. all images are build from a makefile in the subdirectory images/ (see my other Makefile)&lt;br /&gt;&lt;br /&gt;I found those websites useful when building the makefile&lt;br /&gt;&lt;br /&gt;http://www.wlug.org.nz/MakefileHowto&lt;br /&gt;http://www.gnu.org/software/make/manual/html_chapter/make.html&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;TEXFILE=report&lt;br /&gt;&lt;br /&gt;all: $(TEXFILE).pdf&lt;br /&gt;&lt;br /&gt;# .PHONY tells make that these rules don't create any file&lt;br /&gt;# --&gt; if there is a file called all it will still run&lt;br /&gt;.PHONY: all clean images&lt;br /&gt;&lt;br /&gt;%.pdf: %.tex images&lt;br /&gt;	pdflatex $&lt;&lt;br /&gt;	pdflatex $&lt;&lt;br /&gt;&lt;br /&gt;# for subdirectories use the variable $(MAKE)&lt;br /&gt;# -C path/to/directory to tell in which directory to run&lt;br /&gt;#&lt;br /&gt;#  --&gt; note: use environment variables like this $(VARIABLE)&lt;br /&gt;images:&lt;br /&gt;	$(MAKE) -C images &lt;br /&gt;&lt;br /&gt;clean:&lt;br /&gt;	$(MAKE) clean -C images&lt;br /&gt;	rm -f *.aux *.log&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 26 Jan 2006 20:10:03 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1300</guid>
      <author>evan ()</author>
    </item>
    <item>
      <title>Makefile for images in latex</title>
      <link>http://snippets.dzone.com/posts/show/1299</link>
      <description>This is a Makefile to build images for use by pdflatex from .gnuplot command files and .py python scripts. It is supposed that the gnuplot/python files produce .eps images when launched&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;all: sinus.pdf sincos.pdf sine.pdf sine2.pdf sincos2.pdf bode.pdf&lt;br /&gt;&lt;br /&gt;.PHONY: all clean&lt;br /&gt;&lt;br /&gt;# we want all .gnuplot files to be 'made' into .eps files&lt;br /&gt;# the % replaces any name&lt;br /&gt;# in the rule: 	$&lt; replaces the source&lt;br /&gt;# 				$@ replaces the target&lt;br /&gt;# example: convert $&lt; $@&lt;br /&gt;# &lt;br /&gt;%.eps: %.gnuplot&lt;br /&gt;	gnuplot &lt; $&lt;&lt;br /&gt;&lt;br /&gt;%.eps: %.py&lt;br /&gt;	python $&lt;&lt;br /&gt;&lt;br /&gt;%.pdf: %.eps&lt;br /&gt;	epstopdf $&lt;&lt;br /&gt;	&lt;br /&gt;clean:&lt;br /&gt;	rm -f *.eps *.pdf&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 26 Jan 2006 20:08:05 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1299</guid>
      <author>evan ()</author>
    </item>
  </channel>
</rss>
