/LaTeXML-Plugin-sTeX

A LaTeXML Plugin for Semantic LaTeX (sTeX)

Primary LanguagePerlLaTeX Project Public License v1.3cLPPL-1.3c

A LaTeXML plugin for sTeX.

Build Status version

Prerequisites

LaTeXML

You will only be able to use this plugin after you have LaTeXML installed, whose installation steps can be found here.

Trang

This plug in will also need Trang for transforming the schema.

MAC OS
brew install jing-trang

This may prompt you to cask-install Java8, for which you will need sudo rights.

Linux
sudo apt-get install trang
Windows

You can build trang from Github.

How to install

Currently you can do the installation via cpanm or manually. Even though the two methods yield the same results we recommend to stick to only one installation approach for consistency.

First clone this repository somewhere on your computer and

cd <PATH TO THE REPO>
Installation via cpanm

cpanm makes installation for modules much easier. If you don't have cpanm yet, you can get it by

cpan App::cpanminus

You can use it to install almost every perl module using one command

cpanm Module::Name

Now we can just let it do all the work

cpanm .

cpanm will run the included testcases automatically, if any of these testcases failed, the installation will be unsuccessful.

Manual installation

If the above steps don't work for you, you can try to install the plugin manually to see what's wrong.

perl Makefile.PL 
make	
make test 

Then we can finish the installation with

sudo make install

How to use this plugin

This plugin is mainly composed of LaTeXML bindings, profiles, RelaxNG schemas and XSLT stylesheets. After installation, the bindings will go to the Package directory of LaTeXML, and the other files will be added to the resource directory respectively.

Using this plugin is no different than applying LaTeXML on a normal file, here a simple example:

latexmlc --profile stex talk.tex 
  • --profile: we preload different bindings to facilitate the processing time, here the sTeX preloads the bindings provided by this plugin and sets the paths.
  • talk.tex: the file we want to transform, here a talk with sTeX markup This will transform talk.tex into OMDoc form.

A more advanced usage would be to transform an sTeX module, i.e. a fragment that encapsulates specific mathematical knowledge.

latexmlc --profile stex-module pl1-semantics.tex  --preamble ../../../../meta-inf/lib/pre.tex 
--postamble ../../../../meta-inf/lib/post.tex --path ../../../../../../ext/sTeX/sty/etc/

As this is not a standalone LaTeX file we have to specify preamble and postamble files in the --preamble and --postamble options. We can also give additional paths (e.g. for files that come with this plugin in the --path option.

For more info on how to call LaTeXML, please refer to commands.

Documentation

Although LaTeXML-Plugin-sTeX doesn't come with much documentation itself, the use of this plugin is well documented. The documentation has two components:

  • sTeX: each sTeX package has its corresponding LaTeXML binding. The sTeX documentation gives an intuitive understanding of how all the packages work. The LaTeXML bindings do try to mimic the behavior of TeX workflow but just has different output format: OMDoc. The LaTeX workflow produces PDF and the LaTeXML workflow produces OMDoc or OMDoc-annotated HTML (still under development).
  • LaTeXML: having an intuitive understanding is beneficial and it is also important for you to understand how LaTeXML works if you want to change the behaviors of the bindings.

Testcases

The testcases in this repository are a git-subrepo pointing to https://github.com/slatex/sTeX-tests. The test script is roughly adapted from LaTeXML, however in addition to testing pure .xml generation we also test post-processing if an appropriate .omdoc file is present.

To manually generate .omdoc or .xml for testcases, use e.g.

# to build only the '.xml' from the '.tex'
./tools/maketest t/tests/omdoc/pathsuris/defpath.xml
# to build the '.xml' and the '.omdoc' from the '.tex'
./tools/maketest t/tests/omdoc/pathsuris/defpath.omdoc

Copyright (c) 2019 Michael Kohlhase The package is distributed under the terms of the LaTeX Project Public License (LPPL)