summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/luatex/nodetree
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-07-13 22:32:08 +0000
committerKarl Berry <karl@freefriends.org>2016-07-13 22:32:08 +0000
commit588acb7430d398501af794108005cd9d326a3769 (patch)
treea9b14cb6a55108938cfd9ccd9e79fae79c3dd4d3 /Master/texmf-dist/doc/luatex/nodetree
parent0b8f35b425fc6748f9b8503315068e72fb65cd48 (diff)
nodetree (13jul16)
git-svn-id: svn://tug.org/texlive/trunk@41684 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/luatex/nodetree')
-rw-r--r--Master/texmf-dist/doc/luatex/nodetree/README41
-rw-r--r--Master/texmf-dist/doc/luatex/nodetree/README.md131
-rw-r--r--Master/texmf-dist/doc/luatex/nodetree/nodetree.lua45
-rw-r--r--Master/texmf-dist/doc/luatex/nodetree/nodetree.pdfbin306648 -> 395491 bytes
4 files changed, 130 insertions, 87 deletions
diff --git a/Master/texmf-dist/doc/luatex/nodetree/README b/Master/texmf-dist/doc/luatex/nodetree/README
deleted file mode 100644
index 4f82f1e5e24..00000000000
--- a/Master/texmf-dist/doc/luatex/nodetree/README
+++ /dev/null
@@ -1,41 +0,0 @@
-# nodetree
-
-Inspired by a [gist from Patrick Gundlach](https://gist.github.com/pgundlach/556247).
-
-`nodetree` displays some debug informations of the node list in the
-terminal, when you render a Latex document.
-
-```
-post_linebreak_filter:
-│
-├─GLUE subtype: baselineskip; width: 5.06pt;
-└─HLIST subtype: line; width: 345pt; height: 6.94pt; dir: TLT; glue_order: 2; glue_sign: 1; glue_set: 304.99993896484;
- ╚═head:
- ├─LOCAL_PAR dir: TLT;
- ├─HLIST subtype: indent; width: 15pt; dir: TLT;
- ├─GLYPH char: "O"; font: 15; left: 2; right: 3; uchyph: 1; width: 7.78pt; height: 6.83pt;
- ├─DISC subtype: regular; penalty: 50;
- │ ╠═post:
- │ ║ └─GLYPH subtype: ghost; char: "\12"; font: 15; width: 5.56pt; height: 6.94pt;
- │ ║ ╚═components:
- │ ║ ├─GLYPH subtype: ligature; char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ ║ └─GLYPH subtype: ligature; char: "i"; font: 15; left: 2; right: 3; uchyph: 1; width: 2.78pt; height: 6.68pt;
- │ ╠═pre:
- │ ║ ├─GLYPH char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ ║ └─GLYPH char: "-"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.33pt; height: 4.31pt;
- │ ╚═replace:
- │ └─GLYPH subtype: ghost; char: "\14"; font: 15; width: 8.33pt; height: 6.94pt;
- │ ╚═components:
- │ ├─GLYPH subtype: ghost; char: "\11"; font: 15; width: 5.83pt; height: 6.94pt;
- │ │ ╚═components:
- │ │ ├─GLYPH subtype: ligature; char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ │ └─GLYPH subtype: ligature; char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ └─GLYPH subtype: ligature; char: "i"; font: 15; left: 2; right: 3; uchyph: 1; width: 2.78pt; height: 6.68pt;
- ├─GLYPH char: "c"; font: 15; left: 2; right: 3; uchyph: 1; width: 4.44pt; height: 4.31pt;
- ├─GLYPH char: "e"; font: 15; left: 2; right: 3; uchyph: 1; width: 4.44pt; height: 4.31pt;
- ├─PENALTY penalty: 10000;
- ├─GLUE subtype: parfillskip; stretch: 65536; stretch_order: 2;
- └─GLUE subtype: rightskip;
-
-```
-
diff --git a/Master/texmf-dist/doc/luatex/nodetree/README.md b/Master/texmf-dist/doc/luatex/nodetree/README.md
index 4f82f1e5e24..e9f8bb0ee06 100644
--- a/Master/texmf-dist/doc/luatex/nodetree/README.md
+++ b/Master/texmf-dist/doc/luatex/nodetree/README.md
@@ -1,41 +1,104 @@
-# nodetree
-Inspired by a [gist from Patrick Gundlach](https://gist.github.com/pgundlach/556247).
+![nodetree](graphics/packagename.png)
-`nodetree` displays some debug informations of the node list in the
-terminal, when you render a Latex document.
+# Abstract
+`nodetree` is a development package that visualizes the structure of
+node lists. `nodetree` shows its debug informations in the consoles’
+output when you compile a LuaTeX file. It uses a similar visual
+representation for node lists as the UNIX `tree` command uses for a
+folder structure.
+
+Node lists are the main building blocks of each document generated by
+the TeX engine LuaTeX. The package `nodetree` doesn‘t change
+the rendered document. The tree view can only be seen when using a
+terminal to generate the document.
+
+`nodetree` is inspired by a
+[gist from Patrick Gundlach](https://gist.github.com/pgundlach/556247).
+
+# License
+
+Copyright (C) 2016 by Josef Friedrich <josef@friedrich.rocks>
+------------------------------------------------------------------------
+This work may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3 of this license
+or (at your option) any later version. The latest version of this
+license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+# CTAN
+
+Since July 2016 the cloze package is included in the Comprehensive TeX
+Archive Network (CTAN).
+
+* TeX archive: http://mirror.ctan.org/tex-archive/macros/luatex/generic/nodetree
+* Package page: http://www.ctan.org/pkg/nodetree
+
+# Repository
+
+https://github.com/Josef-Friedrich/nodetree
+
+# Installation
+
+Get source:
+
+ git clone git@github.com:Josef-Friedrich/nodetree.git
+ cd nodetree
+
+Compile:
+
+ make
+
+or manually:
+
+ luatex nodetree.ins
+ lualatex nodetree.dtx
+ makeindex -s gglo.ist -o nodetree.gls nodetree.glo
+ makeindex -s gind.ist -o nodetree.ind nodetree.idx
+ lualatex nodetree.dtx
+
+# Examples
+
+## The node list of the package name
+
+```latex
+\documentclass{article}
+\usepackage{nodetree}
+\begin{document}
+nodetree
+\end{document}
+```
+
+![nodetree](graphics/packagename.png)
+
+## The node list of a mathematical formula
+
+```latex
+\documentclass{article}
+\usepackage[callback={mhlist}]{nodetree}
+\begin{document}
+\[\left(a\right)\left[\frac{b}{a}\right]=a\,\]
+\end{document}
```
-post_linebreak_filter:
-│
-├─GLUE subtype: baselineskip; width: 5.06pt;
-└─HLIST subtype: line; width: 345pt; height: 6.94pt; dir: TLT; glue_order: 2; glue_sign: 1; glue_set: 304.99993896484;
- ╚═head:
- ├─LOCAL_PAR dir: TLT;
- ├─HLIST subtype: indent; width: 15pt; dir: TLT;
- ├─GLYPH char: "O"; font: 15; left: 2; right: 3; uchyph: 1; width: 7.78pt; height: 6.83pt;
- ├─DISC subtype: regular; penalty: 50;
- │ ╠═post:
- │ ║ └─GLYPH subtype: ghost; char: "\12"; font: 15; width: 5.56pt; height: 6.94pt;
- │ ║ ╚═components:
- │ ║ ├─GLYPH subtype: ligature; char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ ║ └─GLYPH subtype: ligature; char: "i"; font: 15; left: 2; right: 3; uchyph: 1; width: 2.78pt; height: 6.68pt;
- │ ╠═pre:
- │ ║ ├─GLYPH char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ ║ └─GLYPH char: "-"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.33pt; height: 4.31pt;
- │ ╚═replace:
- │ └─GLYPH subtype: ghost; char: "\14"; font: 15; width: 8.33pt; height: 6.94pt;
- │ ╚═components:
- │ ├─GLYPH subtype: ghost; char: "\11"; font: 15; width: 5.83pt; height: 6.94pt;
- │ │ ╚═components:
- │ │ ├─GLYPH subtype: ligature; char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ │ └─GLYPH subtype: ligature; char: "f"; font: 15; left: 2; right: 3; uchyph: 1; width: 3.06pt; height: 6.94pt;
- │ └─GLYPH subtype: ligature; char: "i"; font: 15; left: 2; right: 3; uchyph: 1; width: 2.78pt; height: 6.68pt;
- ├─GLYPH char: "c"; font: 15; left: 2; right: 3; uchyph: 1; width: 4.44pt; height: 4.31pt;
- ├─GLYPH char: "e"; font: 15; left: 2; right: 3; uchyph: 1; width: 4.44pt; height: 4.31pt;
- ├─PENALTY penalty: 10000;
- ├─GLUE subtype: parfillskip; stretch: 65536; stretch_order: 2;
- └─GLUE subtype: rightskip;
+![nodetree](graphics/math.png)
+
+## The node list of the word 'Office'
+
+The characters 'ffi' are deeply nested in a discretionary node.
+
+```latex
+\documentclass{article}
+\usepackage{nodetree}
+\begin{document}
+Office
+\end{document}
```
+![nodetree](graphics/ligatures.png)
+
diff --git a/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua b/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua
index a123bc42562..170f040c348 100644
--- a/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua
+++ b/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua
@@ -152,8 +152,8 @@ function tpl.round(number)
end
function tpl.length(input)
input = tonumber(input)
- input = input / 2^16
- return string.format('%gpt', tpl.round(input))
+ input = input / tex.sp('1' .. options.unit)
+ return string.format('%g%s', tpl.round(input), options.unit)
end
function tpl.fill(number, order, field)
if order ~= nil and order ~= 0 then
@@ -345,7 +345,15 @@ function tpl.branches(level, connection_type)
return out
end
function tpl.print(text)
- print(text)
+
+ if options.channel == 'log' then
+ if not log then
+ log = io.open(tex.jobname .. '_nodetree.log', 'a')
+ end
+ log:write(text, '\n')
+ else
+ print(' ' .. text)
+ end
end
function tree.format_field(head, field)
local out = ''
@@ -353,10 +361,23 @@ function tree.format_field(head, field)
return ''
end
if options.verbosity < 2 and
+ -- glyph
+ field == 'font' or
+ field == 'left' or
+ field == 'right' or
+ field == 'uchyph' or
+ -- hlist
+ field == 'dir' or
+ field == 'glue_order' or
+ field == 'glue_sign' or
+ field == 'glue_set' or
+ -- glue
+ field == 'stretch_order' then
+ return ''
+ elseif options.verbosity < 3 and
field == 'prev' or
field == 'next' or
field == 'id'
- or field == 'attr'
then
return ''
end
@@ -425,7 +446,6 @@ function tree.analyze_node(head, level)
for field_id, field_name in pairs(node.fields(head.id, head.subtype)) do
if field_name ~= 'next' and
field_name ~= 'prev' and
- field_name ~= 'attr' and
node.is_node(head[field_name]) then
fields[field_name] = head[field_name]
else
@@ -495,7 +515,7 @@ function callbacks.vpack_filter(head, groupcode, size, packtype, maxdepth, direc
groupcode = groupcode,
size = size,
packtype = packtype,
- maxdepth = maxdepth,
+ maxdepth = tpl.length(maxdepth),
direction = direction,
attributelist = attributelist,
}
@@ -503,27 +523,25 @@ function callbacks.vpack_filter(head, groupcode, size, packtype, maxdepth, direc
tree.analyze_callback(head)
return true
end
-function callbacks.hpack_qualtity(incident, detail, head, first, last)
+function callbacks.hpack_quality(incident, detail, head, first, last)
local variables = {
incident = incident,
detail = detail,
first = first,
last = last,
}
- tpl.callback('hpack_qualtity', variables)
+ tpl.callback('hpack_quality', variables)
tree.analyze_callback(head)
- return true
end
-function callbacks.vpack_qualtity(incident, detail, head, first, last)
+function callbacks.vpack_quality(incident, detail, head, first, last)
local variables = {
incident = incident,
detail = detail,
first = first,
last = last,
}
- tpl.callback('vpack_qualtity', variables)
+ tpl.callback('vpack_quality', variables)
tree.analyze_callback(head)
- return true
end
function callbacks.process_rule(head, width, height)
local variables = {
@@ -579,6 +597,7 @@ function callbacks.mlist_to_hlist(head, display_type, need_penalties)
}
tpl.callback('mlist_to_hlist', variables)
tree.analyze_callback(head)
+ return node.mlist_to_hlist(head, display_type, need_penalties)
end
function base.normalize_options()
options.verbosity = tonumber(options.verbosity)
@@ -591,6 +610,8 @@ function base.set_default_options()
engine = 'luatex',
color = 'colored',
decimalplaces = 2,
+ unit = 'pt',
+ channel = 'term',
}
if not options then
options = {}
diff --git a/Master/texmf-dist/doc/luatex/nodetree/nodetree.pdf b/Master/texmf-dist/doc/luatex/nodetree/nodetree.pdf
index 17221eebb72..6ee7e9eedf3 100644
--- a/Master/texmf-dist/doc/luatex/nodetree/nodetree.pdf
+++ b/Master/texmf-dist/doc/luatex/nodetree/nodetree.pdf
Binary files differ