From 2588e9d4318adab459941b9c2bcb885bebc021a2 Mon Sep 17 00:00:00 2001 From: Ioannis Filippidis Date: Sat, 19 Jul 2014 17:28:47 -0700 Subject: [PATCH 1/2] new command \includedottex for including external dot files. The auxiliary tex file names depend on the corresponding dot file's path. Slashes in the path are replaced by underscores, to map dot files directly to tex files, therefore avoid issues caused by the fignum counter when \includeonly is used. A new option "force" enables forcing dot2tex to convert the dot file, even if the output tex file is newer, so that changes in \includedottex command options can become effective. --- dot2texi.sty | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dot2texi.sty b/dot2texi.sty index 12fea51..7d83a4d 100644 --- a/dot2texi.sty +++ b/dot2texi.sty @@ -60,6 +60,7 @@ \ProvidesPackage{dot2texi}[2014/04/25 v3.1-dev Run dot2tex from LaTeX] \RequirePackage{moreverb} \RequirePackage{xkeyval}[2005/02/22] +\RequirePackage{xstring} \newif\ifdtt@ShellEscape %\newif\ifmiktex \miktexfalse @@ -229,6 +230,10 @@ \define@key{dtt}{cache}[]{\def\dtt@cacheopt{--cache}} \define@key{dtt}{nocache}[]{\def\dtt@cacheopt{}} +% force recompilation (e.g. the dot2tex options have changed in the latex file) +\define@key{dtt}{force}[]{\def\dtt@force{--force}} +\def\dtt@force{} + \newif\ifdtt@writetofile \dtt@writetofiletrue \def\dottotexverbatimwrite#1{% @@ -302,4 +307,34 @@ {Please convert \dtt@figname.dot manually}} } +\newcommand\includedottex[2][]{% + \noexpandarg% + \expandafter\StrSubstitute\expandafter{#2}{./}{_}[\x]% + \expandafter\StrSubstitute\expandafter{\x}{/}{_}[\x]% + \expandafter\StrSubstitute\expandafter{\x}{.dot}{.tex}[\x]% + % + \def\dtt@fname{\dtt@outputdir\pathtofname{#2}}% + \setkeys{dtt}{#1}{% + \ifdtt@ShellEscape% + \immediate\write18{ + dot2tex + \dtt@output\space + \dtt@format\space + \dtt@tikzedgelabels\space + \dtt@straightedges\space + \dtt@styleonly\space + \dtt@autosizeopt\space + \dtt@debugstr\space + \dtt@procprog\space + \dtt@mathmode\space + \dtt@graphstyle\space + \dtt@force\space + -o \dtt@outputdir/\x + \dtt@options\space #2 + }% + \fi% + \input{\dtt@outputdir/\x}% + } +}% + \endinput From 2d3a70ff67190c11bd127614210b6d2f443e7ff3 Mon Sep 17 00:00:00 2001 From: Ioannis Filippidis Date: Mon, 28 Jul 2014 22:18:47 -0700 Subject: [PATCH 2/2] rename \includedottex -> \includedot --- dot2texi.sty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dot2texi.sty b/dot2texi.sty index 7d83a4d..9111b94 100644 --- a/dot2texi.sty +++ b/dot2texi.sty @@ -307,7 +307,7 @@ {Please convert \dtt@figname.dot manually}} } -\newcommand\includedottex[2][]{% +\newcommand\includedot[2][]{% \noexpandarg% \expandafter\StrSubstitute\expandafter{#2}{./}{_}[\x]% \expandafter\StrSubstitute\expandafter{\x}{/}{_}[\x]%