dev-master
9999999-devSimple PHP library combining LyX and Twig to create beautiful generated documents in LaTeX.
Apache-2.0
The Requires
- php >=5.3
- twig/twig ^1.14
by Josef Kufner
Simple PHP library combining LyX and Twig to create beautiful generated documents in LaTeX.
LyX-on-Twig is a simple PHP library combining LyX and Twig to create beautiful generated documents in LaTeX. User/programmer creates template in LyX using Twig constructs, this template is compiled to LaTeX source code with Twig constructs, and finally LaTeX template is populated with data, replacing Twig constructs in the process., (*1)
While editing in LyX: |
---|
![]() |
, (*2)
Preview PDF generated directly from LyX (left) and final document (right): |
---|
![]() |
lyx/twig.article.layout
as a layout file. You may want to symlink this file next to your document.lyx -batch -e pdf5 template.twig.lyx
.Compile the template template.twig.tex
to PDF:, (*3)
$lyxtwig = new LyxOnTwig('./', array('cache' => './cache/'));
$output_file = tempnam(tempnam(sys_get_temp_dir(), 'output.');
if ($lyxtwig->render('template.twig.tex', 'template.twig.pdf', array('some' => 'data'))) {
// Do something with PDF in $output_file
}
, (*4)
Fortunately LyX does not escape PDF options (in document settings, PDF
properties), so it is possible to use \noexpand\Twig{expression}
to insert
expression
into PDF title or any other field. The \noexpand
is required to
stop LaTeX from expanding the \Twig
macro which is not defined yet., (*5)
The most of the code is published under Apache 2.0 license. See LICENSE file for details., (*6)
If you wish to send me a patch, please create a Git pull request or send a Git formatted patch via email., (*7)
Simple PHP library combining LyX and Twig to create beautiful generated documents in LaTeX.
Apache-2.0