summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/plantuml
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-03-22 21:43:32 +0000
committerKarl Berry <karl@freefriends.org>2018-03-22 21:43:32 +0000
commit340a2df114efeb3ef71b7b7c65f150bf30634bf5 (patch)
tree6825d98c3a96fb505e5a689c9cde72d6112d4e27 /Master/texmf-dist/tex/lualatex/plantuml
parent92926991fee4079a0d527dad92cf06a8077c8a64 (diff)
plantuml (22mar18)
git-svn-id: svn://tug.org/texlive/trunk@47076 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/plantuml')
-rw-r--r--Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty74
1 files changed, 43 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty b/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty
index 3f16671ea06..2fb13e34644 100644
--- a/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty
+++ b/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty
@@ -3,7 +3,7 @@
%% SPDX-License-Identifier: LPPL-1.3c+
\NeedsTeXFormat{LaTeX2e}\relax
\ProvidesPackage{plantuml}
- [2018/03/08 v0.1.0
+ [2018/03/21 v0.2.1
Embed PlantUML diagrams in latex documents.]
% Required by PlantUML LaTeX output
@@ -41,50 +41,62 @@
\def\maxwidth#1{\ifdim\Gin@nat@width>#1 #1\else\Gin@nat@width\fi}
\makeatother
+\ExplSyntaxOn
+\let\PlantUmlMode\l_plantuml_mode
+\ExplSyntaxOff
+
+\newcounter{PlantUmlFigureNumber}
+
\ifluatex
- \ExplSyntaxOn
- \let\PlantUmlMode\l_plantuml_mode
- \ExplSyntaxOff
\RequirePackage{luacode}
- \makeatletter
- \ifcase\pdf@shellescape
- \message{No shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.}
- \newenvironment{plantuml}{%
- No shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.
- }{}
- \or
+\else
+ \RequirePackage[usefamily=bash]{pythontex}
+\fi
+
+\makeatletter
+\ifcase\pdf@shellescape
+ \message{No shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.}
+ \newenvironment{plantuml}{%
+ No shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.
+ }{}
+\or
+ \ifluatex
\directlua{
local plantUmlJar = os.getenv("PLANTUML_JAR")
if not plantUmlJar then
texio.write_nl("Environment variable PLANTUML_JAR not set.")
end
}
- \NewDocumentEnvironment{plantuml}{}{%
- \VerbatimOut{\jobname-plantuml.txt}}
- {%
- \endVerbatimOut
+ \fi
+ \NewDocumentEnvironment{plantuml}{}{%
+ \VerbatimOut{\jobname-plantuml.txt}}
+ {%
+ \endVerbatimOut
+ \ifluatex
\directlua{
local jobname=\luastring{\jobname}
local plantUmlMode=\luastring{\PlantUmlMode}
require("plantuml.lua")
convertPlantUmlToTikz(jobname, plantUmlMode)
}
- \ifthenelse{\equal{\PlantUmlMode}{latex}}{
- \begin{adjustbox}{max width=\linewidth}
- \input{\jobname-plantuml.latex}
- \end{adjustbox}
- }{
- \includegraphics[width=\maxwidth{\textwidth}]{\jobname-plantuml.\PlantUmlMode}
- }
+ \else
+ \stepcounter{PlantUmlFigureNumber}
+ %TODO: Execute pyhton here
+ \typeout{*** plantuml only works with lualatex ***}
+ \fi
+ \ifthenelse{\equal{\PlantUmlMode}{latex}}{
+ \begin{adjustbox}{max width=\linewidth}
+ \input{\jobname-plantuml.latex}
+ \end{adjustbox}
+ }{
+ \includegraphics[width=\maxwidth{\textwidth}]{\jobname-plantuml.\PlantUmlMode}
}
- \or
- \message{Restricted shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.}
- \newenvironment{plantuml}{%
- Restricted shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.
- }{}
- \fi
- \makeatother
-\else
- \typeout{*** plantuml only works with lualatex ***}
+ }
+\or
+ \message{Restricted shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.}
+ \newenvironment{plantuml}{%
+ Restricted shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.
+ }{}
\fi
+\makeatother