[pmwiki-users] LaTeX markup and PmWiki

José Geraldo Gouvêa jggouvea at globo.com
Tue Apr 24 18:32:28 CDT 2007


Kathryn Andersen escreveu:
> I agree with all these reasons!  That's why I personally went the
> GeneratePDF route, which uses htmldoc for the conversion to PDF.  
I used GeneratePDF for a while, but it still falls short of my goals.
> It isn't as pretty, but it's a heck of a lot easier to set up.  I agree
> that having LaTeX would be nicer, since TeX produces lovely output.
>   
And you haven't seen what xelatex (texlive-xetex) can do using random
fonts installed in your system.
>  
>   
>> I want:
>> a) A simpler solution, for simpler documents
>> b) Using built-in conversion features
>> c) Without the need of an intermediate format and without the need of an
>> external server
>> d) Producing LaTeX output, which I can choose to publish to PDF
>> according to my own specifications.
>>     
>
> This all sounds good.
> So far as I can see, there are two potential routes for such a
> conversion:
> (a) to take the final HTML and convert that to LaTeX (similar to
> what GeneratePDF does, passing the HTML to htmldoc)
> (b) to take the PmWiki markup and convert that to LaTeX
>
> Both have their advantages and disadvantages.  The advantage of approach
> (a) is that one can simply let PmWiki deal with the PmWiki markup
>   
But conversion from HTML to LaTeX is usually lossy and cumbersome.
> The advantage of approach (b) is that one doesn't have to deal with
> (possibly arbitrary) HTML.  The downside of this is the question of how
> one deals with the random arbitrary markup introduced by other recipes.
>   
That's precisely what I am trying to do! My first approach (find it
here: http://www.pmwiki.org/wiki/Cookbook/LatexMarkup) was to use simple
php find-replace:

Markup("emph", "inline", "/\\\emph{(.*?)}/", "<em>$1</em>");

This allows you to pick a LaTeX document and put it into PmWiki. If the
document does not contain overkill features you can configure a series
of rules like these to

a) skip the preamble
b) present in html the known rules
c) ignore the rest or display it as text.

The same way it works with LaTeX input, presneting it as HTML just like
PmWiki markup, it could work for LaTeX output, replacing PmWiki markup
with LaTeX markup and presenting the resulting document between
<pre>tags</pre>. Such behaviour would be associated with a page action
(action=print or action=export, for instance).

But for some reason I can't figure out, if you put a long list of rules
like this, some rules work while others don't. So I was a bit
disencouraged from extending the recipe or from creating the reverse rules.

José Geraldo





More information about the pmwiki-users mailing list