Open main menu

Difference between revisions of "Visual Debugging"

 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
Page is focused on the old [[Mark_II|Mark II]] ConTeXt version, though <tt>\show...</tt> 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 {{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==
+
=Unordered=
  
 
{{cmd|tracefiles}} : ?
 
{{cmd|tracefiles}} : ?
Line 16: Line 20:
  
  
==[[Layout]]==
+
=[[Layout]]=
  
 
{{cmd|showlayout}} : add four pages that show margins, layout sizes etc.
 
{{cmd|showlayout}} : add four pages that show margins, layout sizes etc.
Line 28: 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===
+
==Show attributes of visual elements==
  
 
<texcode>
 
<texcode>
Line 44: Line 48:
 
</texcode>
 
</texcode>
  
===Grid, Layers and Column Sets===
+
==Grid, Layers and Column Sets==
  
 
{{cmd|tracelayers}} : show boxes of layers
 
{{cmd|tracelayers}} : show boxes of layers
Line 56: Line 60:
 
{{cmd|tracegridsnapping}} : ?
 
{{cmd|tracegridsnapping}} : ?
  
===[[Tables Overview|Tables]]===
+
=[[Tables Overview|Tables]]=
  
 
{{cmd|tracetables}} : ?
 
{{cmd|tracetables}} : ?
Line 64: Line 68:
 
{{cmd|tracetabulate}} : ?
 
{{cmd|tracetabulate}} : ?
  
==[[Math]]==
+
=[[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 87: Line 91:
 
{{cmd|tracemathcharacter}} : ?
 
{{cmd|tracemathcharacter}} : ?
  
==[[Bookmarks]] and [[References]]==
+
=[[Bookmarks]] and [[References]]=
  
 
{{cmd|tracebookmarks}} : ?
 
{{cmd|tracebookmarks}} : ?
Line 98: Line 102:
  
  
== Fonts and Type==
+
=Fonts and Type=
  
 
{{cmd|showbodyfont}} : actual bodyfont family with all variants
 
{{cmd|showbodyfont}} : actual bodyfont family with all variants
  
<context>
+
<context source="yes">
\setuplayout[scale=.7]
+
\showbodyfont[pagella,7pt]
\showbodyfont
 
 
</context>
 
</context>
  
 
{{cmd|showbodyfontenvironment}} : draws a table that shows which point sizes match the relative sizes
 
{{cmd|showbodyfontenvironment}} : draws a table that shows which point sizes match the relative sizes
  
<context>
+
<context source="yes">
\setuplayout[scale=.7]
+
\showbodyfontenvironment[pagella,7pt]
\showbodyfontenvironment
 
 
</context>
 
</context>
  
 
{{cmd|showsymbolset}}[''symbolset name''] :  shows all the symbols within a given symbol set
 
{{cmd|showsymbolset}}[''symbolset name''] :  shows all the symbols within a given symbol set
  
<texcode>
+
<context source="yes">
\showsymbolset[navigation 1]
 
</texcode>
 
<context>
 
\setuplayout[scale=.7]
 
 
\showsymbolset[navigation 1]
 
\showsymbolset[navigation 1]
 
</context>
 
</context>
  
{{cmd|showcharacters}} : list of available chars of actual bodyfont encoding (approx. 4 pages, MkII only)
+
{{cmd|ShowCompleteFont}} from module <code>fnt-10</code> : list of available chars of actual bodyfont encoding (for MkII, {{cmd|showcharacters}} lists the available chars of actual bodyfont encoding )
  
<context>
+
<context source="yes">
\setuplayout[height=12cm,scale=.7]
+
\usemodule[fnt-10]
 
\setupcolors[state=start]
 
\setupcolors[state=start]
\showcharacters
+
\starttext
 +
\ShowCompleteFont{name:texgyrepagella}{8pt}{1}
 +
\stoptext
 
</context>
 
</context>
  
{{cmd|showmathcharacters}} : list of all the available math (non-alphabetical) characters available in math, now including all the AMS characters. MkII only
+
{{cmd|showmathcharacters}} from module <code>math-characters</code> : list of all the available math (non-alphabetical) characters available in math, now including all the AMS characters.
  
<context>
+
<context source="yes">
\setuplayout[height=12cm,scale=.7]
+
\usemodule[math-characters]
 
\setupcolors[state=start]
 
\setupcolors[state=start]
\showmathcharacters
+
\setupbodyfont[pagella,7pt]
</context>
+
\starttext
 
+
\showmathfontcharacters
{{cmd|showaccents}} : shows A-Z and a-z with all available accents, MkII only
+
\stoptext
 
 
<context>
 
\setuplayout[height=18cm,scale=.7]
 
\setupcolors[state=start]
 
\showaccents
 
 
</context>
 
</context>
  
Line 152: Line 147:
 
''(Make a better, slightly more complex example.)''
 
''(Make a better, slightly more complex example.)''
  
<texcode>
+
<context source="yes">
\setupframed[framecolor=gray]
+
\setupbodyfont[pagella,7pt]
\showstruts
+
\framed[frame=off,align=normal]{\showstruts
 
This will display \strut struts.\crlf
 
This will display \strut struts.\crlf
Frame with struts: \framed{xxx}\crlf
+
A frame with strut \framed[strut=yes]{xxx} and frame without \framed[strut=no]{xxx}}
And frame without them: \framed[strut=no]{xxx}
 
</texcode>
 
<context>
 
\setuplayout[scale=.7]
 
\setupcolors[state=start]
 
\setupframed[framecolor=gray]
 
\showstruts
 
This will display \strut struts.\crlf
 
Frame with struts: \framed{xxx}\crlf
 
And frame without them: \framed[strut=no]{xxx}
 
 
</context>
 
</context>
  
 +
{{cmd|showfontstrip}} : the current typeface combination, with roman, sans, math, and teletype families visualised, with x-heights and m widths.
  
{{cmd|showfontstrip}} : the current typeface combination, with roman, sans, math, and teletype families visualised, with x-heights
+
<context source="yes">
 
+
\setupbodyfont[pagella,7pt]
<context>
+
\framed[frame=off]{\showfontstrip}
\setuplayout[scale=.7]
 
\showfontstrip
 
 
</context>
 
</context>
 
{{cmd|tracefonthandling}} :
 
 
{{cmd|tracechinese}} : ?
 
  
 
{{cmd|tracedfontname}}''{Font Name}'' : Chain of synonyms for the given font name
 
{{cmd|tracedfontname}}''{Font Name}'' : Chain of synonyms for the given font name
  
<texcode>
+
<context source="yes">
\tracedfontname{Bold}
+
\setupbodyfont[pagella,7pt]
</texcode>
+
\framed[frame=off]{\tracedfontname{Bold}}
 
 
<context>
 
\setuplayout[scale=.7]
 
\tracedfontname{Bold}
 
 
</context>
 
</context>
  
{{cmd|tracedfontencoding}} : ?
+
=Colors=
 
 
== Colors and Graphics ==
 
 
 
===Colors===
 
  
 
{{cmd|showcolor}} : see [[Color]]
 
{{cmd|showcolor}} : see [[Color]]
Line 214: Line 186:
 
{{cmd|tracedspotcolormode}} : ?
 
{{cmd|tracedspotcolormode}} : ?
  
===Figures===
+
=Figures=
  
 
{{cmd|showexternalfigures}} : ?
 
{{cmd|showexternalfigures}} : ?
Line 223: Line 195:
  
  
===Interaction===
+
=Interaction=
  
 
{{cmd|showfields}} : ?
 
{{cmd|showfields}} : ?
Line 237: Line 209:
 
[[Category:Tools]]
 
[[Category:Tools]]
 
[[Category:Layout]]
 
[[Category:Layout]]
 +
[[Category:Fonts]]

Latest revision as of 12:58, 18 May 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).

Unordered

\tracefiles : ?

\tracepositions : ?

\traceposstring : ?

\traceboxplacement : ?

\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

\usemodule [setups]

\starttext

% \setuphead [..,..=..,..]
\showrootvalues [head]

% \setuphead [chapter] [..,..=..,..]
\showinstancevalues [head] [chapter]

\stoptext

Grid, Layers and Column Sets

\tracelayers : show boxes of layers

\tracecolumnset : ?

\tracetextareas : ?

\showgrid : make line grid visible

\tracegridsnapping : ?

Tables

Math

\tracemathtrue : show the layout boxes for left, middle, or right-aligned formulas.

\tracemathcommand : ?

\tracemathcollection : ?

\tracemathsymbol{name of math symbol} : show the command (name of symbol) and the symbol itself

\tracemathcollectiontrue
\tracemathsymbol{Re}
\tracemathsymbol{Im}

 

\tracemathcharacter : ?

Bookmarks and References

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

Figures

Interaction

\showfields : ?

\tracefields : ?

\traceJScode : trace JavaScript code


 
TODO: A lot of commands and switches are still unexplained. (See: To-Do List)