https://wiki.contextgarden.net/api.php?action=feedcontributions&user=BruXy&feedformat=atomWiki - User contributions [en]2024-03-29T07:38:53ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Visual_Debugging&diff=24081Visual Debugging2019-02-25T19:03:13Z<p>BruXy: /* Layout */</p>
<hr />
<div>< [[Inside ConTeXt]] | [[Visuals]] ><br />
<br />
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).<br />
<br />
==Unordered==<br />
<br />
{{cmd|tracefiles}} : ?<br />
<br />
{{cmd|tracepositions}} : ?<br />
<br />
{{cmd|traceposstring}} : ?<br />
<br />
{{cmd|traceboxplacement}} : ?<br />
<br />
{{cmd|traceotr}} : output routine?<br />
<br />
{{cmd|showboxes}} : show boxes<br />
<br />
<br />
==[[Layout]]==<br />
<br />
{{cmd|showlayout}} : add four pages that show margins, layout sizes etc.<br />
<br />
{{cmd|showsetups}} : typeset a list of all defined sizes (variables) and their values<br />
<br />
{{cmd|showmakeup}} : show some otherwise invisible markup<br />
<br />
{{cmd|showframe}} : show frames of text area, layers, boxes etc.<br />
<br />
===Show attributes of visual elements===<br />
<br />
<texcode><br />
\usemodule [setups]<br />
<br />
\starttext<br />
<br />
% \setuphead [..,..=..,..]<br />
\showrootvalues [head]<br />
<br />
% \setuphead [chapter] [..,..=..,..]<br />
\showinstancevalues [head] [chapter]<br />
<br />
\stoptext<br />
</texcode><br />
<br />
===Grid, Layers and Column Sets===<br />
<br />
{{cmd|tracelayers}} : show boxes of layers<br />
<br />
{{cmd|tracecolumnset}} : ?<br />
<br />
{{cmd|tracetextareas}} : ?<br />
<br />
{{cmd|showgrid}} : make line grid visible<br />
<br />
{{cmd|tracegridsnapping}} : ?<br />
<br />
===[[Tables Overview|Tables]]===<br />
<br />
{{cmd|tracetables}} : ?<br />
<br />
{{cmd|traceTABLE}} : ?<br />
<br />
{{cmd|tracetabulate}} : ?<br />
<br />
==[[Math]]==<br />
<br />
{{cmd|tracemathtrue}} : show the layout boxes for left, middle, or right-aligned formulas.<br />
<br />
{{cmd|tracemathcommand}} : ?<br />
<br />
{{cmd|tracemathcollection}} : ?<br />
<br />
{{cmd|tracemathsymbol}}''{name of math symbol}'' : show the command (name of symbol) and the symbol itself<br />
<br />
<texcode><br />
\tracemathcollectiontrue<br />
\tracemathsymbol{Re}<br />
\tracemathsymbol{Im}<br />
</texcode><br />
<context><br />
\tracemathcollectiontrue<br />
\tracemathsymbol{Re}<br />
\tracemathsymbol{Im}<br />
</context><br />
<br />
{{cmd|tracemathcharacter}} : ?<br />
<br />
==[[Bookmarks]] and [[References]]==<br />
<br />
{{cmd|tracebookmarks}} : ?<br />
<br />
{{cmd|tracelinenotes}} : ?<br />
<br />
{{cmd|tracereferences}} : ?<br />
<br />
{{cmd|tracelabels}} : ?<br />
<br />
<br />
==[[Fonts]] and Type==<br />
<br />
{{cmd|showbodyfont}} : actual bodyfont family with all variants<br />
<br />
<context><br />
\setuplayout[scale=.7]<br />
\showbodyfont<br />
</context><br />
<br />
{{cmd|showbodyfontenvironment}} : draws a table that shows which point sizes match the relative sizes<br />
<br />
<context><br />
\setuplayout[scale=.7]<br />
\showbodyfontenvironment<br />
</context><br />
<br />
{{cmd|showsymbolset}}[''symbolset name''] : shows all the symbols within a given symbol set<br />
<br />
<texcode><br />
\showsymbolset[navigation 1]<br />
</texcode><br />
<context><br />
\setuplayout[scale=.7]<br />
\showsymbolset[navigation 1]<br />
</context><br />
<br />
{{cmd|showcharacters}} : list of available chars of actual bodyfont encoding (approx. 4 pages, MkII only)<br />
<br />
<context><br />
\setuplayout[height=12cm,scale=.7]<br />
\setupcolors[state=start]<br />
\showcharacters<br />
</context><br />
<br />
{{cmd|showmathcharacters}} : list of all the available math (non-alphabetical) characters available in math, now including all the AMS characters. MkII only<br />
<br />
<context><br />
\setuplayout[height=12cm,scale=.7]<br />
\setupcolors[state=start]<br />
\showmathcharacters<br />
</context><br />
<br />
{{cmd|showaccents}} : shows A-Z and a-z with all available accents, MkII only<br />
<br />
<context><br />
\setuplayout[height=18cm,scale=.7]<br />
\setupcolors[state=start]<br />
\showaccents<br />
</context><br />
<br />
{{cmd|showstruts}} : display struts (invisible placeholders for proper minimum line heights)<br />
<br />
''(Make a better, slightly more complex example.)''<br />
<br />
<texcode><br />
\setupframed[framecolor=gray]<br />
\showstruts<br />
This will display \strut struts.\crlf<br />
Frame with struts: \framed{xxx}\crlf<br />
And frame without them: \framed[strut=no]{xxx}<br />
</texcode><br />
<context><br />
\setuplayout[scale=.7]<br />
\setupcolors[state=start]<br />
\setupframed[framecolor=gray]<br />
\showstruts<br />
This will display \strut struts.\crlf<br />
Frame with struts: \framed{xxx}\crlf<br />
And frame without them: \framed[strut=no]{xxx}<br />
</context><br />
<br />
<br />
{{cmd|showfontstrip}} : the current typeface combination, with roman, sans, math, and teletype families visualised, with x-heights<br />
<br />
<context><br />
\setuplayout[scale=.7]<br />
\showfontstrip<br />
</context><br />
<br />
{{cmd|tracefonthandling}} : <br />
<br />
{{cmd|tracechinese}} : ?<br />
<br />
{{cmd|tracedfontname}}''{Font Name}'' : Chain of synonyms for the given font name<br />
<br />
<texcode><br />
\tracedfontname{Bold}<br />
</texcode><br />
<br />
<context><br />
\setuplayout[scale=.7]<br />
\tracedfontname{Bold}<br />
</context><br />
<br />
{{cmd|tracedfontencoding}} : ?<br />
<br />
== Colors and Graphics ==<br />
<br />
===Colors===<br />
<br />
{{cmd|showcolor}} : see [[Color]]<br />
<br />
{{cmd|showcolorgroup}} : ?<br />
<br />
{{cmd|showpalet}} : ?<br />
<br />
{{cmd|tracedgreymode}} : ?<br />
<br />
{{cmd|tracedgreycolormode}} : ?<br />
<br />
{{cmd|tracedrgbcolormode}} : ?<br />
<br />
{{cmd|tracedcmykcolormode}} : ?<br />
<br />
{{cmd|tracedspotcolormode}} : ?<br />
<br />
===Figures===<br />
<br />
{{cmd|showexternalfigures}} : ?<br />
<br />
{{cmd|traceexternalfigures}} : ?<br />
<br />
{{cmd|tracesidefloats}} : ?<br />
<br />
<br />
===Interaction===<br />
<br />
{{cmd|showfields}} : ?<br />
<br />
{{cmd|tracefields}} : ?<br />
<br />
{{cmd|traceJScode}} : trace JavaScript code<br />
<br />
<br />
{{todo|A lot of commands and switches are still unexplained.}}</div>BruXyhttps://wiki.contextgarden.net/index.php?title=Chinese_Japanese_and_Korean&diff=23479Chinese Japanese and Korean2017-09-06T00:55:01Z<p>BruXy: Updating example of Chinese document.</p>
<hr />
<div>< [[Fonts]] | [[Encodings and Regimes]] ><br />
<br />
* old introduction [[Uptodate]] by Pragma: [http://www.pragma-ade.com/general/uptodate/up-007-s.pdf screen] and [http://www.pragma-ade.com/general/uptodate/up-007-p.pdf paper] version<br />
* manual by Pragma: [http://www.pragma-ade.com/general/manuals/mchinese.pdf Chinese in ConTeXt]<br />
<br />
=Chinese in ConTeXt=<br />
<br />
Get inspirated with importing Chinese fonts with this [https://github.com/BruXy/ConTeXt-Chinese script].<br />
<br />
# You need some Chinese (TrueType) fonts; you may want to get for example Microsoft Truetype fonts:<br />
## [http://archive1.village.virginia.edu/spw4s/fonts/STSONG.TTF STSong],<br />
## [http://archive1.village.virginia.edu/spw4s/fonts/STZHONGS.TTF STZhongsong],<br />
## [http://archive1.village.virginia.edu/spw4s/fonts/STXIHEI.TTF STXihei],<br />
## [http://archive1.village.virginia.edu/spw4s/fonts/STKAITI.TTF STKaiti],<br />
## [http://archive1.village.virginia.edu/spw4s/fonts/STFANGSO.TTF STFangsong].<br />
# Example of some basic document with enabled Chinese:<br />
<br />
<texcode><br />
\mainlanguage[cn]<br />
\language[cn]<br />
\enableregime[utf]<br />
\setscript[hanzi] % hyphenation<br />
<br />
% Enable fonts<br />
\usetypescriptfile[mscore]<br />
\setupbodyfont [mschinese,12pt]<br />
\usebodyfont [mschinese-light,12pt]<br />
\definebodyfontenvironment[24pt]<br />
\definebodyfontenvironment[18pt]<br />
<br />
\setuppagenumber [numberconversion=cn]<br />
\definestructureconversionset[chinese][numbers][cn]<br />
\setupheads [sectionconversionset=chinese]<br />
<br />
\define[2]\ChineseChapter{第#1章 #2}<br />
\setuphead[chapter][command=\ChineseChapter,style={\bf\switchtobodyfont[24pt]}]<br />
\setuphead[section][style={\bf\switchtobodyfont[18pt]}]<br />
<br />
<br />
\setuppagenumbering[state=start,<br />
alternative=singlesided,<br />
location={footer, center},<br />
style={\bf\switchtobodyfont[11pt]}<br />
]<br />
<br />
\starttext<br />
\chapter{华文字体系列}<br />
<br />
在微软提供的 Office 套装中附带了一定数量的中文字体,这些字体是常州华文印刷新技术有限公司制造的。<br />
<br />
\startitemize<br />
\item \type{\it}: {\it 华文仿宋}<br />
\item \type{\rm}: {\rm 华文仿宋}<br />
\item \type{\bf}: {\bf 华文中宋}<br />
\item \type{\ss}: {\ss 华文细黑}<br />
\item \type{\tfxx}: {\tfxx 华文仿宋}<br />
\item \type{\tfx}: {\tfx 华文仿宋}<br />
\item \type{\tf}: {\tf 华文仿宋}<br />
\item \type{\tfa}: {\tfa 华文仿宋}<br />
\item \type{\tfb}: {\tfb 华文仿宋}<br />
\item \type{\tfc}: {\tfc 华文仿宋}<br />
\item \type{\tfd}: {\tfd 华文仿宋}<br />
\stopitemize<br />
\stoptext<br />
</texcode><br />
<br />
== Chinese numbers ==<br />
<br />
Added by Xiao Jianfeng<br />
<br />
As far as I know, it is wrong to use "零" with "一,二,....,十".<br />
Following is the corresponding relationships between lower case and upper case Chinese numbers and arabic numbers.<br />
<br />
Chinese lower:〇,一,二,三,四,五,六,七,八,九,十,百,千<br />
<br />
Chinese upper:零,壹,贰,叁,肆,伍,陆,柒,捌,玖,拾,佰,仟<br />
<br />
Arabic :0, 1, 2,3, 4,5, 6, 7,8, 9,10,100,1000<br />
<br />
"零" is a upper case Chinese number, so it should not be mixed with other lower case Chinese numbers. Although in China, it is sometimes wrongly used.<br />
<br />
The reason why numbers in Chinese has lower case and upper case in Chinese is for accounting safety. Lower case numbers are simple to write and far more often used in daily life, while upper case numbers are almost exclusively used in accouting. <br />
<br />
We can see that every upper case Chinese number are very different from the others, hence cannot be easily modified to the other . But the lower case Chinese number or Arabic numbers are sometime easily to be modified. For example, "一", "二" and "三" are similar so one can easily modify a "一" to "二" or "三".And one can also modify "1" to "7" or "11", or one can modify "6" to "8".<br />
<br />
In China, numbers must be written in both Chinese upper case and Arabic form together in accounting.<br />
<br />
== See also ==<br />
* [[CJK fonts]]<br />
<br />
[[Category:Fonts]]<br />
[[Category:International]]</div>BruXyhttps://wiki.contextgarden.net/index.php?title=Quotes&diff=20055Quotes2012-07-18T18:47:59Z<p>BruXy: Nested quotations in MkIV</p>
<hr />
<div>< [[Visuals]]<br />
<br />
==Basic commands==<br />
<br />
Don't try to type quotation marks, but use logical markup!<br />
Quotation marks and formatting are language dependent.<br />
<br />
; single quotes : {{cmd|quote|{some text}}}<br />
; double quotes : {{cmd|quotation|{some text}}}<br />
; long quote sections : try {{cmd|startquote}} or {{cmd|startquotation}} etc.<br />
<br />
<br />
==Nested quotations==<br />
<br />
The following commands can be used to automatically nest double and single quotes.<br />
<br />
<context source="yes"><br />
\setuppapersize[A5]<br />
<br />
\setupdelimitedtext<br />
[quotation]<br />
[1]<br />
[left={\symbol[leftquotation]},<br />
right={\symbol[rightquotation]}]<br />
<br />
\setupdelimitedtext<br />
[quotation]<br />
[2]<br />
[left={\symbol[leftquote]},<br />
right={\symbol[rightquote]}]<br />
<br />
\setupdelimitedtext<br />
[quotation]<br />
[3]<br />
[left={\symbol[leftquotation]},<br />
right={\symbol[rightquotation]}]<br />
<br />
\quotation{A long quotation in which one character says,<br />
\quotation{Eh? What am I supposed to say? Something like, \quotation<br />
{Quotations in this sentance are nested}?}}<br />
</context><br />
<br />
<br />
==Nested quotations in MkIV==<br />
<br />
<context source="yes"><br />
\enableregime[utf]<br />
<br />
\setuplanguage[cz]<br />
[leftquotation=„,<br />
rightquotation=“,<br />
leftquote=‚,<br />
rightquote=‘]<br />
<br />
\mainlanguage[cz]<br />
<br />
\starttext<br />
Following example is not correct. Typography rules for Czech language <br />
for quotes \quotation{of text in quotes define \quotation{nested inner} quotes}.<br />
<br />
And now correct version. Typography rules for Czech language for quotes<br />
\quotation{of text in quotes define to \quote{nested inner} quotes}.<br />
<br />
\setupdelimitedtext[quotation:1][left={\symbol[leftquotation]},right={\symbol[rightquotation]}]<br />
\setupdelimitedtext[quotation:2][left={\symbol[leftquote]}, right={\symbol[rightquote]}]<br />
<br />
Automatic nesting. Typography rules for Czech language for quotes \quotation{of <br />
text in quotes define to \quotation{nested inner} quotes}.<br />
<br />
\setupdelimitedtext[quotation:1][left=»,right=«]<br />
\setupdelimitedtext[quotation:2][left=›,right=‹]<br />
<br />
Another type of quotes now. Typography rules for Czech language for French quotes <br />
\quotation{of text in quotes define to \quotation{nested inner} quotes}.<br />
\stoptext <br />
<br />
</context><br />
<br />
==Long quotations and extracts==<br />
<br />
The following may serve as a guide to others in formatting long quotations or extracts:<br />
<br />
===Long quotations defined with {{cmd|definestartstop}}===<br />
<br />
In body text:<br />
<br />
<texcode><br />
\defineblank[extractdistance][3pt]<br />
<br />
\definestartstop[extract][<br />
before={\blank[extractdistance] % [extractdistance,force] causes spurious <br />
% overfull \hbox warnings<br />
\setupnarrower[left=1.5pc,right=1.5pc]<br />
\startnarrower[left,right]<br />
\noindent},<br />
after={\stopnarrower<br />
\blank[extractdistance]<br />
\indenting[yes]}]<br />
</texcode><br />
<br />
In footnotes:<br />
<br />
<texcode><br />
\defineblank[footenoteextractdistance][2.7pt]<br />
<br />
\definestartstop[fnextract][<br />
before={\blank[footenoteextractdistance]<br />
\setupnarrower[left=1.5pc,right=1.5pc]<br />
\startnarrower[left,right]<br />
\noindent},<br />
after={\stopnarrower<br />
\blank[footenoteextractdistance]<br />
\indenting[yes]}]<br />
</texcode><br />
<br />
===Long quotations defined with {{cmd|definedelimitedtext}} ===<br />
<br />
In body text:<br />
<br />
<texcode><br />
\defineblank[extractdistance][3pt]<br />
<br />
\definedelimitedtext[extract][blockquote]<br />
<br />
\setupdelimitedtext<br />
[extract]<br />
[spacebefore=extractdistance,<br />
leftmargin=1.5pc,<br />
before={\setupindenting[next]}]<br />
</texcode><br />
<br />
In footnotes:<br />
<br />
<texcode><br />
\defineblank[footenoteextractdistance][2.7pt]<br />
<br />
\definedelimitedtext[fnextract][blockquote]<br />
<br />
\setupdelimitedtext<br />
[fnextract]<br />
[spacebefore=footenoteextractdistance,<br />
leftmargin=1.5pc,<br />
before={\setupindenting[next]}]<br />
</texcode><br />
<br />
==Example using {{cmd|setupdelimitedtext}}==<br />
<br />
Here is how to get indented quotations set in small type:<br />
<texcode><br />
\setupdelimitedtext[blockquote][style={\setupbodyfont[9pt]}]<br />
Hello<br />
\startblockquote<br />
\input knuth<br />
\par<br />
\stopblockquote<br />
Hello<br />
</texcode><br />
<br />
The {{cmd|par}} inside the block quotation keeps TeX's paragraph builder happy. Otherwise the last paragraph in the block quotation gets the wider linespacing of the outside environment rather than the narrower linespacing appropriate to nine-point text.<br />
<br />
Using {{code|1=style=small}} does not work as well as <code>style={\setupbodyfont[9pt]}</code> or <code>style={\setupbodyfont[10pt]}</code>, because {{code|small}} shrinks only the font size but not the linespacing.</div>BruXy