diff options
Diffstat (limited to 'Master/texmf-dist')
14 files changed, 259 insertions, 159 deletions
diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.pdf b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.pdf Binary files differdeleted file mode 100644 index 8991337eb24..00000000000 --- a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.tex b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.tex deleted file mode 100644 index f57fb7c539d..00000000000 --- a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.tex +++ /dev/null @@ -1,48 +0,0 @@ -\documentclass{article} -\usepackage{graphics} -\newcommand\LuaLaTeX{Lua\LaTeX} - -\begin{document} -\section{Documentation} - -When you load the package \texttt{lua-visual-debug} in your \LuaLaTeX\ document, \LaTeX\ will highlight boxes, penalties, glues and kerns in the PDF. This package requires you to process the document with \LuaLaTeX. - -\begin{verbatim} -\documentclass{article} -\usepackage{lua-visual-debug} - -\listfiles -\setlength\textwidth{300pt} -\setlength\textheight{10cm} - -\begin{document} - -A wonderful serenity has taken possession of my entire soul, like these sweet -mornings of spring which I enjoy with my whole heart. I am alone, and feel the -charm of existence in this spot, which was created for the bliss of souls like -mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere -tranquil existence, that I neglect my talents. - - -\bgroup\fontsize{30}{34}\selectfont -\centerline{\TeX} -\egroup - -\vbox{\strut Hello}\kern .5cm\vbox{\strut World} - -\[ e=mc^2 \] - -\includegraphics[width=4cm]{cow} -\end{document} -\end{verbatim} - -yields \vspace{5mm} - -\noindent \includegraphics{lvdebug-sample.pdf} - -\section{Copying} - -Copyright 2012 Patrick Gundlach (patrick@gundla.ch), licensed under the MIT license. See the Lua file for details. - - -\end{document} diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-sample.pdf b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-sample.pdf Binary files differdeleted file mode 100644 index 3c011d86e48..00000000000 --- a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-sample.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/README b/Master/texmf-dist/doc/luatex/lua-visual-debug/README index ffec4835ed8..94fd2312ec9 100644 --- a/Master/texmf-dist/doc/lualatex/lua-visual-debug/README +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/README @@ -1,12 +1,22 @@ -The LaTeX package 'lua-visual-debug' shows boxes, glues, kerns and +The LuaTeX package 'lua-visual-debug' shows boxes, glues, kerns and penalties in the PDF output. Usage: +LaTeX: + \usepackage{lua-visual-debug} -Requirements: The package only works with LuaLaTeX. - With other engines, a warning message will be shown. +or (plain) + +\input lua-visual-debug + + + +Requirements: The package has only been tested with LuaTeX and + the formats plain and LaTeX. Other formats might work as well, + but other engines only show a warning message. + Copyright 2012 Patrick Gundlach (patrick@gundla.ch) Public repository: https://github.com/pgundlach/lvdebug diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf Binary files differnew file mode 100644 index 00000000000..62aa83bdfa1 --- /dev/null +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex new file mode 100644 index 00000000000..3655b96c1d1 --- /dev/null +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex @@ -0,0 +1,49 @@ +\documentclass{article} +\usepackage{graphicx,listings,lmodern} +\newcommand\LuaLaTeX{Lua\LaTeX} + +\newcommand*\pgsmall{\fontsize{8.5}{8.7}\selectfont\ttfamily} +\lstset{basicstyle=\pgsmall, + basewidth=0.55em, + columns=fullflexible, + breakautoindent=true, + breaklines=true, + prebreak=, + postbreak=\mbox{$\hookrightarrow$}, +} + +\begin{document} +\title{The lua-visual-debug package (V0.2)} +\author{Patrick Gundlach} +% \address{patrick@gundla.ch} +\maketitle +\section{About} + +This package aids debugging your \TeX\ and \LaTeX\ document by drawing rectangles around boxes and rules where glue is inserted. Other items are marked as well: kerns, hyphenation points and penalties. + +\section{How to use} + +When you load the package \texttt{lua-visual-debug} in your \LuaLaTeX\ document (or use \verb|\input lua-visual-debug.sty| in plain \TeX), Lua\TeX\ will highlight boxes, penalties, glues and kerns in the PDF. This package requires you to process the document with \LaTeX\ (plain and LaTeX formats). + +\section{A \LaTeX\ example} +\lstinputlisting[language=tex]{sample.tex} + +\noindent yields \vspace{5mm} + +\noindent \includegraphics[width=\textwidth]{sample-crop.pdf} + +\section{A plain \TeX\ example} + +\lstinputlisting[language=tex]{sample-plain.tex} + +\noindent yields \vspace{5mm} + +\noindent \includegraphics{sample-plain-crop.pdf} + + +\section{Copying} + +Copyright 2012 Patrick Gundlach (patrick@gundla.ch), licensed under the MIT license. See the Lua file for details. + + +\end{document} diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf Binary files differnew file mode 100644 index 00000000000..f77d7bf010c --- /dev/null +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.tex b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.tex new file mode 100644 index 00000000000..da1e423238f --- /dev/null +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.tex @@ -0,0 +1,16 @@ +\input lua-visual-debug.sty + +\hsize 3in \vsize 3in +\centerline{A centered line with \TeX} + +\vskip .5in + +A wonderful serenity has taken possession of my entire soul, like these sweet +mornings of spring which I enjoy with my whole heart. I am alone, and feel +the charm of existence in this spot, which was created for the bliss of souls +like mine. I am so happy, my dear friend, so absorbed in the exquisite sense +of mere tranquil existence, that I neglect my talents. + +$$\int_e^x=mc^2$$ + +\bye diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf Binary files differnew file mode 100644 index 00000000000..088303edca9 --- /dev/null +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/sample.tex b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.tex index 44be4b744ad..7a0c75e4f36 100644 --- a/Master/texmf-dist/doc/lualatex/lua-visual-debug/sample.tex +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.tex @@ -1,18 +1,25 @@ \documentclass{article} \usepackage{lua-visual-debug} -\listfiles +\usepackage{lmodern} \setlength\textwidth{300pt} \setlength\textheight{10cm} \begin{document} -A wonderful serenity has taken possession of my entire soul, like these sweet -mornings of spring which I enjoy with my whole heart. I am alone, and feel the -charm of existence in this spot, which was created for the bliss of souls like -mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere -tranquil existence, that I neglect my talents. +\section{A short story} +A wonderful serenity has taken possession of my entire soul, like these sweet +mornings of spring which I enjoy with my whole heart. I am alone, and feel +the charm of existence in this spot, which was created for the bliss of souls +like mine. I am so happy, my dear friend, so absorbed in the exquisite sense +of mere tranquil existence, that I neglect my talents. + +\begin{itemize} + \item one + \item two + \item three +\end{itemize} \bgroup\fontsize{30}{34}\selectfont \centerline{\TeX} @@ -20,7 +27,6 @@ tranquil existence, that I neglect my talents. \vbox{\strut Hello}\kern .5cm\vbox{\strut World} -\[ e=mc^2 \] +\[ \int_e^x=mc^2 \] -%\includegraphics[width=4cm]{cow} \end{document} diff --git a/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.lua b/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.lua deleted file mode 100644 index 1e37af791c0..00000000000 --- a/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.lua +++ /dev/null @@ -1,91 +0,0 @@ --- Copyright 2012 Patrick Gundlach, patrick@gundla.ch --- released under the "MIT license" (see footer of this file) --- Public repository: https://github.com/pgundlach/lvdebug (issues/pull requests,...) - -module(...,package.seeall) - -local factor = 65782 -- big points vs. TeX points -local rule_width = 0.1 - - -local function draw_pagebox(head,parent) - while head do - if head.id == 0 or head.id == 1 then -- hbox / vbox - - local wd = head.width / factor - rule_width - local ht = (head.height + head.depth) / factor - rule_width - local dp = head.depth / factor - rule_width / 2 - - draw_pagebox(head.list,head) - local wbox = node.new("whatsit","pdf_literal") - if head.id == 0 then -- hbox - wbox.data = string.format("q 0.5 G %g w %g %g %g %g re s Q", rule_width, -rule_width / 2, -dp, wd, ht) - else - wbox.data = string.format("q 0.1 G %g w %g %g %g %g re s Q", rule_width, -rule_width / 2, 0, wd, -ht) - end - wbox.mode = 0 - - head.list = node.insert_before(head.list,head.list,wbox) - - elseif head.id == 10 then -- glue - local wd = head.spec.width - local color = "0.5 G" - if parent.glue_sign == 1 and parent.glue_order == head.spec.stretch_order then - wd = wd + parent.glue_set * head.spec.stretch - color = "0 0 1 RG" - elseif parent.glue_sign == 2 and parent.glue_order == head.spec.shrink_order then - wd = wd - parent.glue_set * head.spec.shrink - color = "1 0 1 RG" - end - - local wbox = node.new("whatsit","pdf_literal") - if parent.id == 0 then --hlist - wbox.data = string.format("q %s [0.2] 0 d 0.5 w 0 0 m %g 0 l s Q",color,wd / factor) - else -- vlist - wbox.data = string.format("q 0.1 G 0.1 w -0.5 0 m 0.5 0 l -0.5 %g m 0.5 %g l s [0.2] 0 d 0.5 w 0.25 0 m 0.25 %g l s Q",-wd / factor,-wd / factor,-wd / factor) - end - wbox.mode = 0 - - node.insert_before(parent.list,head,wbox) - elseif head.id == 11 then -- kern - local wbox = node.new("whatsit","pdf_literal") - local color = "1 1 0 rg" - if head.kern < 0 then color = "1 0 0 rg" end - if parent.id == 0 then --hlist - wbox.data = string.format("q %s 0 w 0 0 %g 1 re B Q",color, head.kern / factor ) - else - wbox.data = string.format("q %s 0 w 0 0 1 %g re B Q",color, -head.kern / factor ) - end - node.insert_before(parent.list,head,wbox) - elseif head.id == 12 then -- penalty - local color = "1 g" - local wbox = node.new("whatsit","pdf_literal") - if head.penalty < 10000 then - color = string.format("%d g", 1 - head.penalty / 10000) - end - wbox.data = string.format("q %s 0 w 0 0 1 1 re B Q",color) - node.insert_before(parent.list,head,wbox) - else - -- ignore - end - head = head.next - end -end - -local function draw() - draw_pagebox(tex.box["AtBeginShipoutBox"].list,tex.box["AtBeginShipoutBox"]) -end - -return { draw = draw } - --- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, --- publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do --- so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE --- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION --- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.sty b/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.sty deleted file mode 100644 index 95671861a2e..00000000000 --- a/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.sty +++ /dev/null @@ -1,9 +0,0 @@ -\ProvidesPackage{lua-visual-debug}[2012/02/22 v0.1 Visual debugging in LuaLaTeX (PGU)] -\RequirePackage{ifluatex} -\ifluatex - \RequirePackage{luatexbase,atbegshi} - \directlua{ lvdebug = require("lua-visual-debug") } - \AtBeginShipout {\directlua{lvdebug.draw()}} -\else - \PackageWarning{lua-visual-debug}{You are using this package without LuaTeX. This is not supported, so you don't get any visual debugging.} -\fi diff --git a/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua new file mode 100644 index 00000000000..e4aae142737 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua @@ -0,0 +1,132 @@ +-- Copyright 2012 Patrick Gundlach, patrick@gundla.ch +-- Public repository: https://github.com/pgundlach/lvdebug (issues/pull requests,...) + +-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, +-- publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do +-- so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +-- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +-- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +module(...,package.seeall) + +-- There are 65782 scaled points in a PDF point +-- Therefore we need to devide all TeX lengths by +-- this amount to get the PDF points. +local number_sp_in_a_pdf_point = 65782 + + +-- The idea is the following: at page shipout, all elements on a page are fixed. +-- TeX creates an intermediate data structure before putting that into the PDF +-- We can "intercept" that data structure and add pdf_literal (whatist) nodes, +-- that makes glues, kerns and other items visible by drawing a rule, rectangle or +-- other visual aids. +-- This has no influence on typeset material, because these pdf_literal instructions +-- are only visible to the PDF file (PDF renderer) and have no size themselves. + +-- We recursively loop through the contents of boxes and look at the (linear) list of +-- items in that box. We start at the "shipout box". + +-- The "algorithm" goes like this: +-- +-- head = pointer_to_beginning_of_box_material +-- while head is not nil +-- if this_item_is_a_box +-- recurse_into_contents +-- draw a rectangle around the contents +-- elseif this_item_is_a_glue +-- draw a rule that has the length of that glue +-- elseif this_item_is_a_kern +-- draw a rectangle with width of that kern +-- ... +-- end +-- move pointer to the next item in the list +-- -- the pointer is "nil" if there is no next item +-- end + + +function show_page_elements(parent) + local head = parent.list + while head do + if head.id == 0 or head.id == 1 then -- hbox / vbox + + local rule_width = 0.1 + local wd = head.width / number_sp_in_a_pdf_point - rule_width + local ht = (head.height + head.depth) / number_sp_in_a_pdf_point - rule_width + local dp = head.depth / number_sp_in_a_pdf_point - rule_width / 2 + + -- recurse into the contents of the box + show_page_elements(head) + local rectangle = node.new("whatsit","pdf_literal") + if head.id == 0 then -- hbox + rectangle.data = string.format("q 0.5 G %g w %g %g %g %g re s Q", rule_width, -rule_width / 2, -dp, wd, ht) + else + rectangle.data = string.format("q 0.1 G %g w %g %g %g %g re s Q", rule_width, -rule_width / 2, 0, wd, -ht) + end + head.list = node.insert_before(head.list,head.list,rectangle) + + + elseif head.id == 2 then -- rule + if head.width == 0 then head.width = 0.4 * 2^16 end + local goback = node.new("kern") + goback.kern = -head.width + node.insert_after(parent.list,head,goback) + head = goback + + + elseif head.id == 7 then -- disc + local hyphen_marker = node.new("whatsit","pdf_literal") + hyphen_marker.data = "q 0 0 1 RG 0.3 w 0 -1 m 0 0 l S Q" + parent.list = node.insert_before(parent.list,head,hyphen_marker) + + + elseif head.id == 10 then -- glue + local wd = head.spec.width + local color = "0.5 G" + if parent.glue_sign == 1 and parent.glue_order == head.spec.stretch_order then + wd = wd + parent.glue_set * head.spec.stretch + color = "0 0 1 RG" + elseif parent.glue_sign == 2 and parent.glue_order == head.spec.shrink_order then + wd = wd - parent.glue_set * head.spec.shrink + color = "1 0 1 RG" + end + local pdfstring = node.new("whatsit","pdf_literal") + if parent.id == 0 then --hlist + pdfstring.data = string.format("q %s [0.2] 0 d 0.5 w 0 0 m %g 0 l s Q",color,wd / number_sp_in_a_pdf_point) + else -- vlist + pdfstring.data = string.format("q 0.1 G 0.1 w -0.5 0 m 0.5 0 l -0.5 %g m 0.5 %g l s [0.2] 0 d 0.5 w 0.25 0 m 0.25 %g l s Q",-wd / number_sp_in_a_pdf_point,-wd / number_sp_in_a_pdf_point,-wd / number_sp_in_a_pdf_point) + end + parent.list = node.insert_before(parent.list,head,pdfstring) + + + elseif head.id == 11 then -- kern + local rectangle = node.new("whatsit","pdf_literal") + local color = "1 1 0 rg" + if head.kern < 0 then color = "1 0 0 rg" end + if parent.id == 0 then --hlist + rectangle.data = string.format("q %s 0 w 0 0 %g 1 re B Q",color, head.kern / number_sp_in_a_pdf_point ) + else + rectangle.data = string.format("q %s 0 w 0 0 1 %g re B Q",color, -head.kern / number_sp_in_a_pdf_point ) + end + parent.list = node.insert_before(parent.list,head,rectangle) + + elseif head.id == 12 then -- penalty + local color = "1 g" + local rectangle = node.new("whatsit","pdf_literal") + if head.penalty < 10000 then + color = string.format("%d g", 1 - head.penalty / 10000) + end + rectangle.data = string.format("q %s 0 w 0 0 1 1 re B Q",color) + parent.list = node.insert_before(parent.list,head,rectangle) + end + head = head.next + end +end + diff --git a/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty new file mode 100644 index 00000000000..72839e48d93 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty @@ -0,0 +1,35 @@ +% Version: 0.2 +% see lua file for copyright information (MIT License) + +\expandafter\ifx\csname ProvidesPackage\endcsname\relax + \input ifluatex.sty\relax +\else + \NeedsTeXFormat{LaTeX2e} + \ProvidesPackage{lua-visual-debug}[2012/02/24 v0.2 Visual debugging in LuaLaTeX (PGU)] + \RequirePackage{ifluatex} +\fi + +\def\dothings{% + \directlua{ lvd = require("lua-visual-debug")}% + \AtBeginShipout {\directlua{lvd.show_page_elements(tex.box["AtBeginShipoutBox"])}}% +} + +\expandafter\ifx\csname ProvidesPackage\endcsname\relax + \ifluatex + \input atbegshi.sty\relax + \dothings + \AtBeginShipoutInit + \else + \message{Warning: lua-visual-debug only works with LuaTeX (plain and LaTeX format)} + \fi +\else + \ifluatex + \RequirePackage{luatexbase,atbegshi} + \dothings + \else + \PackageWarning{lua-visual-debug}{You are using this package without LuaTeX. This is not supported, so you don't get any visual debugging.} + \fi +\fi + + + |