# -*- mode: Perl -*-
# /=====================================================================\ #
# | pgf.sty | #
# | Implementation for LaTeXML | #
# |=====================================================================| #
# | Part of LaTeXML: | #
# | Public domain software, produced as part of work done by the | #
# | United States Government & not subject to copyright in the US. | #
# |---------------------------------------------------------------------| #
# | Thanks to Silviu Vlad Oprea <s.oprea@jacobs-university.de> | #
# | of the arXMLiv group for initial implementation | #
# | http://arxmliv.kwarc.info/ | #
# | Released under the Gnu Public License | #
# | Released to the Public Domain | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov> #_# | #
# | http://dlmf.nist.gov/LaTeXML/ (o o) | #
# \=========================================================ooo==U==ooo=/ #
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;
DefMacro('\pgfsysdriver', 'pgfsys-latexml.def'); # and we'll load the .ltxml!
# We're going to load the raw tex of pgf ...
# AND all the files it includes!
# (we should turn off @)#@# comments while we're at it!)
InputDefinitions('pgf', type => 'sty', noltxml => 1);
Let('\pgfutil@IfFileExists', '\IfFileExists'); # Since used for binaries...
# This is very probably the wrong way to do this,
# but it seems that pgfstrokecolor is the color used for default drawing, text, etc.
Let('\pgfsetcolor@orig', '\pgfsetcolor');
DefMacro('\pgfsetcolor{}', '\pgfsetcolor@orig{#1}\lxSVG@set@color');
DefPrimitive('\lxSVG@set@color', sub {
MergeFont(color => LookupValue('color_pgfstrokecolor')); });
# This makes this conditional always true; Why???
DefConditionalI('\ifpgf@relevantforpicturesize', undef, sub { 1; });
DefMacroI('\pgf@relevantforpicturesizefalse', undef, '');
DefMacroI('\pgf@relevantforpicturesizetrue', undef, '');
# These wrap pgfpicture with lxSVG@picture (but wait till everything loaded!)
AtBeginDocument(
'\expandafter\def\expandafter\pgfpicture\expandafter{\expandafter\lxSVG@picture\pgfpicture}'
. '\expandafter\def\expandafter\endpgfpicture\expandafter{\endpgfpicture\endlxSVG@picture}');
# define "q" forms of some commands??
DefMacro('\pgfpathqmoveto{}{}', '\pgfpathmoveto{\pgfqpoint{#1}{#2}}');
DefMacro('\pgfpathqlineto{}{}', '\pgfpathlineto{\pgfqpoint{#1}{#2}}');
DefMacro('\pgfpathqcircle{}', '\pgfpathcircle{\pgfpointorigin}{#1}');
DefMacro('\pgfpathqcurveto{}{}{}{}{}{}',
'\pgfpathcurveto{\pgfqpoint{#1}{#2}}{\pgfqpoint{#3}{#4}}{\pgfqpoint{#5}{#6}}');
# Wrap tikzpicture?
#RawTeX('\expandafter\def\expandafter\tikzpicture\expandafter{\expandafter\lxSVG@picture\tikzpicture}');
#RawTeX('\expandafter\def\expandafter\endtikzpicture\expandafter{\endtikzpicture\endlxSVG@picture}');
1;