Texcaller
Texcaller PostgreSQL interface
Synopsis
texcaller_convert(source text, source_format text, result_format text, max_runs integer) returns bytea stable strict
texcaller_escape_latex(s text) returns text immutable strict

Description

These PostgreSQL functions are simple wrappers around the Texcaller C interface library functions, bringing TeX typesetting into the world of relational databases.

Invalid TeX documents are handled gracefully by simply returning NULL rather than aborting with an error. On failure as well as on success, additional processing information is provided via NOTICEs.

Example
set standard_conforming_strings = on;
-- simple table to store the LaTeX sources of various documents
create table documents (
name varchar(32) primary key,
latex_source text
);
-- insert a sample document
insert into documents (name, latex_source) values (
'hello',
'\documentclass{article}\begin{document}Hello world!\end{document}'
);
-- generate PDF from the sample document
select
texcaller_convert(latex_source, 'LaTeX', 'PDF', 5)
from
documents
where
name = 'hello';
-- generate a document on the fly, demonstrating how to escape user input
select
texcaller_convert(
'\documentclass{article}'
|| '\usepackage[utf8x]{inputenc}'
|| '\begin{document}'
|| texcaller_escape_latex('Téxt → "with" $peciäl <characters>')
|| '\end{document}',
'LaTeX', 'PDF', 5
);