Difference between revisions of "Visual Debugging"
(9 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
There's a whole lot of commands that help you analyzing and debugging your ConTeXt documents. Most of them start with {{cmd|show...}} or {{cmd|trace...}}. While {{cmd|showsomething}} is a command that immediately inserts something, {{cmd|tracesomethingtrue}} or ...<tt>false</tt> is a switch that influences the behaviour of some other commands. You can check the setting with {{cmd|iftrace...}}. In the following we leave out the boolean value (true or false). | There's a whole lot of commands that help you analyzing and debugging your ConTeXt documents. Most of them start with {{cmd|show...}} or {{cmd|trace...}}. While {{cmd|showsomething}} is a command that immediately inserts something, {{cmd|tracesomethingtrue}} or ...<tt>false</tt> is a switch that influences the behaviour of some other commands. You can check the setting with {{cmd|iftrace...}}. In the following we leave out the boolean value (true or false). | ||
− | + | =Unordered= | |
{{cmd|tracefiles}} : ? | {{cmd|tracefiles}} : ? | ||
Line 20: | Line 20: | ||
− | + | =[[Layout]]= | |
{{cmd|showlayout}} : add four pages that show margins, layout sizes etc. | {{cmd|showlayout}} : add four pages that show margins, layout sizes etc. | ||
Line 32: | Line 32: | ||
{{cmd|showlayoutcomponents}} : To allow Acrobat Reader users (among others?) to make layers visible/invisible at will, add this command at the start of your file. | {{cmd|showlayoutcomponents}} : To allow Acrobat Reader users (among others?) to make layers visible/invisible at will, add this command at the start of your file. | ||
− | + | ==Show attributes of visual elements== | |
− | < | + | With {{cmd|showrootvalues}} and {{cmd|showinstancevalues}} |
+ | |||
+ | <context source="yes"> | ||
\usemodule [setups] | \usemodule [setups] | ||
\starttext | \starttext | ||
+ | |||
+ | % \setuphead [chapter] [..,..=..,..] | ||
+ | \showinstancevalues [head] [chapter] | ||
% \setuphead [..,..=..,..] | % \setuphead [..,..=..,..] | ||
\showrootvalues [head] | \showrootvalues [head] | ||
− | |||
− | |||
− | |||
\stoptext | \stoptext | ||
− | </ | + | </context> |
− | + | ==Grid, Layers and Column Sets== | |
{{cmd|tracelayers}} : show boxes of layers | {{cmd|tracelayers}} : show boxes of layers | ||
Line 60: | Line 62: | ||
{{cmd|tracegridsnapping}} : ? | {{cmd|tracegridsnapping}} : ? | ||
− | + | =[[Tables Overview|Tables]]= | |
{{cmd|tracetables}} : ? | {{cmd|tracetables}} : ? | ||
Line 68: | Line 70: | ||
{{cmd|tracetabulate}} : ? | {{cmd|tracetabulate}} : ? | ||
− | + | =[[Math]]= | |
{{cmd|tracemathtrue}} : show the layout boxes for left, middle, or right-aligned formulas. | {{cmd|tracemathtrue}} : show the layout boxes for left, middle, or right-aligned formulas. | ||
Line 91: | Line 93: | ||
{{cmd|tracemathcharacter}} : ? | {{cmd|tracemathcharacter}} : ? | ||
− | + | =[[Bookmarks]] and [[References]]= | |
{{cmd|tracebookmarks}} : ? | {{cmd|tracebookmarks}} : ? | ||
Line 148: | Line 150: | ||
<context source="yes"> | <context source="yes"> | ||
− | \ | + | \setupbodyfont[pagella,7pt] |
− | \ | + | \framed[frame=off,align=normal]{\showstruts |
− | |||
− | \showstruts | ||
This will display \strut struts.\crlf | This will display \strut struts.\crlf | ||
− | A frame with strut \framed[strut=yes]{xxx} and frame without \framed[strut=no]{xxx} | + | A frame with strut \framed[strut=yes]{xxx} and frame without \framed[strut=no]{xxx}} |
</context> | </context> | ||
− | {{cmd|showfontstrip}} : the current typeface combination, with roman, sans, math, and teletype families visualised, with x-heights | + | {{cmd|showfontstrip}} : the current typeface combination, with roman, sans, math, and teletype families visualised, with x-heights and m widths. |
− | <context> | + | <context source="yes"> |
− | \ | + | \setupbodyfont[pagella,7pt] |
− | \showfontstrip | + | \framed[frame=off]{\showfontstrip} |
</context> | </context> | ||
− | |||
− | |||
− | |||
− | |||
{{cmd|tracedfontname}}''{Font Name}'' : Chain of synonyms for the given font name | {{cmd|tracedfontname}}''{Font Name}'' : Chain of synonyms for the given font name | ||
− | < | + | <context source="yes"> |
− | \ | + | \setupbodyfont[pagella,7pt] |
− | + | \framed[frame=off]{\tracedfontname{Bold}} | |
− | |||
− | |||
− | \ | ||
− | \tracedfontname{Bold} | ||
</context> | </context> | ||
− | |||
− | |||
=Colors= | =Colors= | ||
Line 221: | Line 211: | ||
[[Category:Tools]] | [[Category:Tools]] | ||
[[Category:Layout]] | [[Category:Layout]] | ||
− | [[Category: | + | [[Category:Fonts]] |
Latest revision as of 12:46, 2 June 2024
Page is focused on the old Mark II ConTeXt version, though \show... commands are still the same. Work-in-progress page on current LMTX version is Debugging.
There's a whole lot of commands that help you analyzing and debugging your ConTeXt documents. Most of them start with \show... or \trace.... While \showsomething is a command that immediately inserts something, \tracesomethingtrue or ...false is a switch that influences the behaviour of some other commands. You can check the setting with \iftrace.... In the following we leave out the boolean value (true or false).
Contents
Unordered
\tracefiles : ?
\tracepositions : ?
\traceposstring : ?
\traceotr : output routine?
\showboxes : show boxes
Layout
\showlayout : add four pages that show margins, layout sizes etc.
\showsetups : typeset a list of all defined sizes (variables) and their values
\showmakeup : show some otherwise invisible markup
\showframe : show frames of text area, layers, boxes etc.
\showlayoutcomponents : To allow Acrobat Reader users (among others?) to make layers visible/invisible at will, add this command at the start of your file.
Show attributes of visual elements
With \showrootvalues and \showinstancevalues
\usemodule [setups] \starttext % \setuphead [chapter] [..,..=..,..] \showinstancevalues [head] [chapter] % \setuphead [..,..=..,..] \showrootvalues [head] \stoptext
Grid, Layers and Column Sets
\tracelayers : show boxes of layers
\tracecolumnset : ?
\tracetextareas : ?
\showgrid : make line grid visible
Tables
\tracetables : ?
\traceTABLE : ?
\tracetabulate : ?
Math
\tracemathtrue : show the layout boxes for left, middle, or right-aligned formulas.
\tracemathsymbol{name of math symbol} : show the command (name of symbol) and the symbol itself
\tracemathcollectiontrue \tracemathsymbol{Re} \tracemathsymbol{Im}
Bookmarks and References
\tracebookmarks : ?
\tracelinenotes : ?
\tracereferences : ?
\tracelabels : ?
Fonts and Type
\showbodyfont : actual bodyfont family with all variants
\showbodyfont[pagella,7pt]
\showbodyfontenvironment : draws a table that shows which point sizes match the relative sizes
\showbodyfontenvironment[pagella,7pt]
\showsymbolset[symbolset name] : shows all the symbols within a given symbol set
\showsymbolset[navigation 1]
\ShowCompleteFont from module fnt-10
: list of available chars of actual bodyfont encoding (for MkII, \showcharacters lists the available chars of actual bodyfont encoding )
\usemodule[fnt-10] \setupcolors[state=start] \starttext \ShowCompleteFont{name:texgyrepagella}{8pt}{1} \stoptext
\showmathcharacters from module math-characters
: list of all the available math (non-alphabetical) characters available in math, now including all the AMS characters.
\usemodule[math-characters] \setupcolors[state=start] \setupbodyfont[pagella,7pt] \starttext \showmathfontcharacters \stoptext
\showstruts : display struts (invisible placeholders for proper minimum line heights)
(Make a better, slightly more complex example.)
\setupbodyfont[pagella,7pt] \framed[frame=off,align=normal]{\showstruts This will display \strut struts.\crlf A frame with strut \framed[strut=yes]{xxx} and frame without \framed[strut=no]{xxx}}
\showfontstrip : the current typeface combination, with roman, sans, math, and teletype families visualised, with x-heights and m widths.
\setupbodyfont[pagella,7pt] \framed[frame=off]{\showfontstrip}
\tracedfontname{Font Name} : Chain of synonyms for the given font name
\setupbodyfont[pagella,7pt] \framed[frame=off]{\tracedfontname{Bold}}
Colors
\showcolor : see Color
\showcolorgroup : ?
\showpalet : ?
\tracedgreymode : ?
Figures
\tracesidefloats : ?
Interaction
\showfields : ?
\tracefields : ?
\traceJScode : trace JavaScript code
TODO: A lot of commands and switches are still unexplained. (See: To-Do List) |