summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-08-08 21:50:40 +0000
committerKarl Berry <karl@freefriends.org>2007-08-08 21:50:40 +0000
commit650cdd5b518f5b67a30cce8bdc9f894d3b57e755 (patch)
tree971d62cfc32b9fd0fa42cfb9753a63c94c8f2cf8 /Master/texmf-dist/metapost
parentb88972521e85212bc48e30f7dff70d5d8b6a8fda (diff)
belated latexmp update per florent, 08 Aug 2007 11:31:12, debigan bug 435132
git-svn-id: svn://tug.org/texlive/trunk@4720 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/latexmp/latexmp.mp69
1 files changed, 37 insertions, 32 deletions
diff --git a/Master/texmf-dist/metapost/latexmp/latexmp.mp b/Master/texmf-dist/metapost/latexmp/latexmp.mp
index 3be76550b79..fea35e5332d 100644
--- a/Master/texmf-dist/metapost/latexmp/latexmp.mp
+++ b/Master/texmf-dist/metapost/latexmp/latexmp.mp
@@ -1,11 +1,11 @@
%D \module
%D [ file=latexmp.mp,
%D system={latexMP},
-%D version=1.1.0,
+%D version=1.2.1,
%D title=latexMP,
%D subtitle=LaTeX typesetting in \METAPOST,
%D author=Jens-Uwe Morawski,
-%D date={2003/10/02},
+%D date={2005/04/06},
%D copyright={none; this module is Public Domain}]
%D
%C - all variables start with prefix "latexmp_"
@@ -20,16 +20,13 @@ boolean latexmp_module ; latexmp_module := true ;
%D set the name of the temporary file
string latexmp_lmpfile ; latexmp_lmpfile := "ltx-" & jobname & ".tmp" ;
-%D since {\LaTeX} will be used a different \type{prologues} setting
-%D makes not much sense
-prologues:=2 ;
-
%D save some original \METAPOST\ definitions
inner end ; inner bye ;
let origEnd_latexmp=end ;
let origBye_latexmp=bye ;
let origShipit_latexmp=shipit ;
string latexmp_extrabeginfig, latexmp_extraendfig ;
+extra_endfig := extra_endfig & "; resetattachstrings_latexmp ;" ;
latexmp_extrabeginfig := extra_beginfig ;
latexmp_extraendfig := extra_endfig ;
color latexmp_background ;
@@ -89,7 +86,7 @@ def setupLaTeXMP(text kvps) =
numeric mode, normal, rerun ;
normal:=1 ; rerun := 2 ;
%D declaration of keys and synonyms for the specials
- save textextlabel, multicolor, debug ;
+ save textextlabel, multicolor, debug, enable, disable ;
boolean textextlabel, multicolor, debug, enable, disable ;
enable:=true ; disable := false ;
@@ -191,24 +188,6 @@ enddef;
def writeLaTeXpreamble_latexmp =
write "verbatimtex" to latexmp_lmpfile ;
write "%&latex" to latexmp_lmpfile ;
- if latexmp_multicolor:
- write ("\makeatletter") to latexmp_lmpfile ;
- write ("\font\latexmp@special=cmtt8 scaled 250") to latexmp_lmpfile ;
- write ("\def\reset@color{" &
- "\parbox[t][0pt][t]{0pt}{\makebox[0pt][l]{\latexmp@special ecolorxxx}}}")
- to latexmp_lmpfile ;
- write ("\newcommand*{\color}[2][named]{\parbox[t][0pt][t]{0pt}{" &
- "\makebox[0pt][l]{\latexmp@special bcolorxxx:#1:#2}}" &
- "\aftergroup\reset@color\ignorespaces}") to latexmp_lmpfile ;
- write ("\def\textcolor#1#{\@textcolor{#1}}") to latexmp_lmpfile ;
- write ("\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}")
- to latexmp_lmpfile ;
- write ("\newcommand*{\transparent}[3][1]{\parbox[t][0pt][t]{0pt}{"&
- "\makebox[0pt][l]{\latexmp@special btransxxx:#1,#2}}"&
- "#3\parbox[t][0pt][t]{0pt}{" &
- "\makebox[0pt][l]{\latexmp@special etransxxx}}}") to latexmp_lmpfile ;
- write "\makeatother" to latexmp_lmpfile ;
- fi;
%D If preamble file has been specified in the setup only a
%D \type{\input} for this file will be used in the LaTeX preamble:
if (length latexmp_preamblefile)>0:
@@ -236,6 +215,24 @@ def writeLaTeXpreamble_latexmp =
write latexmp_preamble to latexmp_lmpfile ;
fi
fi;
+ if latexmp_multicolor:
+ write ("\makeatletter") to latexmp_lmpfile ;
+ write ("\font\latexmp@special=cmtt8 scaled 250") to latexmp_lmpfile ;
+ write ("\def\reset@color{" &
+ "\parbox[t][0pt][t]{0pt}{\makebox[0pt][l]{\latexmp@special ecolorxxx}}}")
+ to latexmp_lmpfile ;
+ write ("\newcommand*{\color}[2][named]{\parbox[t][0pt][t]{0pt}{" &
+ "\makebox[0pt][l]{\latexmp@special bcolorxxx:#1:#2}}" &
+ "\aftergroup\reset@color\ignorespaces}") to latexmp_lmpfile ;
+ write ("\def\textcolor#1#{\@textcolor{#1}}") to latexmp_lmpfile ;
+ write ("\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}")
+ to latexmp_lmpfile ;
+ write ("\newcommand*{\transparent}[3][1]{\parbox[t][0pt][t]{0pt}{"&
+ "\makebox[0pt][l]{\latexmp@special btransxxx:#1,#2}}"&
+ "#3\parbox[t][0pt][t]{0pt}{" &
+ "\makebox[0pt][l]{\latexmp@special etransxxx}}}") to latexmp_lmpfile ;
+ write "\makeatother" to latexmp_lmpfile ;
+ fi;
write "\begin{document}" to latexmp_lmpfile ;
write "etex" to latexmp_lmpfile ;
write "picture latexmp_picture[];" to latexmp_lmpfile ;
@@ -249,17 +246,26 @@ vardef textext@#(expr s)=
latexmp_counter:= latexmp_counter+1 ;
getpicture_latexmp ;
addstring_latexmp(s) ;
- thelabel@#(pic,origin)
+ if (length (str @#))>0 :
+ % V. 1.1 compatible with MetaFun
+ thelabel@#(pic,origin)
+ else:
+ % V. 1.2 better compatibility with btex..etex
+ pic
+ fi
enddef;
-%D setting \type{latexmp_attachstrings} to \type{1} enables attaching
-%D of strings \type{latexmp_prepend} and \type{latexmp_append} to the
-%D string passed to \type{textext}. This may be useful for package
+%D strings \type{latexmp_prepend} and \type{latexmp_append} are attached
+%D to the string passed to \type{textext}. This may be useful for package
%D authors to implement styling interfaces.
-newinternal latexmp_attachstrings ; latexmp_attachstrings:=0 ;
string latexmp_prepend, latexmp_append ;
latexmp_prepend:= "" ; latexmp_append := "" ;
+%D is called at each endfig via extra_endfig
+def resetattachstrings_latexmp =
+ latexmp_prepend:= "" ; latexmp_append := "" ;
+enddef;
+
def addstring_latexmp(expr s)=
if not latexmp_texinit:
write EOF to latexmp_lmpfile ;
@@ -267,8 +273,7 @@ def addstring_latexmp(expr s)=
latexmp_texinit := true ;
fi;
write "latexmp_picture[" & (decimal latexmp_counter) & "]:= btex " &
- if latexmp_attachstrings=1: latexmp_prepend & s & latexmp_append else: s fi
- & " etex ;" to latexmp_lmpfile ;
+ latexmp_prepend & s & latexmp_append & " etex ;" to latexmp_lmpfile ;
enddef;
def getpicture_latexmp =