<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\chapter{çĺ­}

ĺ¨ \in[item-sym-diy] čä¸­ďźä˝&nbsp;ĺˇ˛çťč§čżçĺ­äşďźĺŞćŻéŁćśĺŻč˝ä˝&nbsp;čżä¸çĽĺśçŠśçŤďźćŹçŤ&nbsp;ĺ°ć­ĺźĺŽäťŹçä¸äşçŤŻĺŞăäšćĺŻč˝ä˝&nbsp;ćŠĺˇ˛éťç&nbsp;čż Knuth çăThe \TeX\ BookăďźĺŻšçĺ­çç&nbsp;çŠśäšćˇąĺˇ˛çťčŽŠććéŁčćďźä˝ćŻćŞĺżçć \ConTeXt\ ççĺ­ďźćčćŹçŤ&nbsp;äťćé¨ĺĺĺŽšĺźĺžä¸çšă

\section{\TeX\ çĺ­}

ĺé˘ĺˇ˛çťĺ¤ćŹĄćç¤şĺćç¤şďź\TeX\ çłťçťćŻ \ConTeXt\ çĺşĺąďźäşčçĺłçłťçšĺŚĺźćďźĺĺ¨ćşďźĺćą˝č˝ŚçĺłçłťăĺŻš \TeX\ ĺźćä¸ćŻŤä¸ćďźĺšśä¸ĺ˝ąĺä˝&nbsp;ĺ­Śäš&nbsp;ĺä˝żç¨ \ConTeXt\ ćçä¸äť˝ç˛žč´çććĄŁďźä˝ćŻćä¸äşĺźćĺąé˘ĺˇĽä˝ĺçďźćŞĺżäźćç¨ĺ¤ďźä˝ćŻä˝&nbsp;ç°ĺ¨äšĺšśä¸č˝çĄŽĺŽĺ°ćĽäźä¸äźćä¸şä¸ĺ \TeX\ éťĺŽ˘ďźĺŚĺä˝&nbsp;äťĺäšäťćŞćłčżćä¸ĺ¤Šäźĺ­Śäš&nbsp; \ConTeXtă

ĺ¨ \TeX\ çłťçťä¸­ďźçĺ­ćŻĺžéčŚçé¨äťśăäžĺŚďźĺ¨ \ConTeXt\ çćççćŻä¸ä¸ŞćŽľč˝ďźćŻä¸ä¸ŞçŤĺçĺ­ďźĺł \type{\vbox}ďźčŻĽçĺ­äšĺĺćä¸äşć¨Şĺçĺ­ďźĺł \type{\hbox}ďźĺŽäťŹćŻćŽľč˝çćŻä¸čĄăćäťŹĺŻäťĽç´ćĽç¨čżä¸¤ç§çĺ­ćé&nbsp;ä¸ä¸Şä¸çč§ć´çćŽľč˝ďź

\startsample
\vbox{
  \hbox{çŚťçŚťĺä¸č}\hbox{ä¸ĺ˛ä¸ćŻčŁ}\hbox{éçŤç§ä¸ĺ°˝}\hbox{ćĽéŁĺšĺç}
}
\stopsample
\sample[option=TEX][todo-list]{çŤĺçĺ­ĺć¨Şĺçĺ­}{\externalfigure[11/vbox-and-hbox.pdf]}

ć¨Şĺçĺ­ĺŻäťĽćĺŽĺŽçéżĺşŚďźçŤĺçĺ­ĺŻäťĽćĺŽĺŽçéŤĺşŚăäžĺŚďź

\starttyping[option=TEX]
\hbox to 5cm {čľĺžĺ¤ĺčéĺŤ}
\vbox to 3cm {
  \hbox{çŚťçŚťĺä¸č}\hbox{ä¸ĺ˛ä¸ćŻčŁ}\hbox{éçŤç§ä¸ĺ°˝}\hbox{ćĽéŁĺšĺç}
}
\stoptyping

ĺ¨ç¤şäž \in[rsquare] ä¸­ďź\type{\hbox} ç¨äşĺĺŤä¸ĺŻä˝żç¨ \METAPOST\ čŻ­č¨çťĺśçç˘éćĺžďźĺłéŽäťŁç&nbsp;ĺŚä¸ďź

\starttyping[option=TEX]
\startuseMPgraphic{foo}
... ... ...
\stopuseMPgraphic
\lower.2ex\hbox{\useMPgraphic{foo}}
\stoptyping

\noindent ĺśä¸­ \type{useMPgraphic} çŻĺ˘ä¸­ç \METAPOST\ äťŁç&nbsp;äźč˘Ť \type{\useMPgraphic{foo}} ćäş¤çť \TeX\ ĺźćă\TeX\ ĺźćäźč°ç¨ metapost ç¨ĺşĺ° \METAPOST\ äťŁç&nbsp;çźčŻć PDF ć&nbsp;źĺźçĺžçďźçśĺäş¤çť \ConTeXtăćĺçą \ConTeXt\ ĺ°ĺžçćĺĽĺ° \type{\useMPgraphic{foo}} ćĺ¨çć¨Şĺçĺ­éă\type{\lower .2ex} ĺŻäť¤ä˝äşĺśĺçć¨Şĺçĺ­ä¸ć˛ 0.2 exăéżĺşŚĺä˝ ex çąťäźźäş emďźäšćŻä¸ä¸Şç¸ĺŻšĺ°şĺŻ¸ďźĺŽćŻĺ˝ĺćç¨ĺ­ä˝ä¸­çĺ­ćŻ x ĺŻšĺşçĺ­ĺ˝˘çéŤĺşŚăäťç°ĺ¨ĺźĺ§čŚčŽ°ä˝ďźć¨ŞĺčˇçŚťç¨ emďźçŤĺčˇçŚťç¨ exďźä¸čżčżĺŞćŻĺťşčŽŽďźĺšśé \TeX\ ä¸ççćłĺžă

čżćä¸ç§ć¨Şĺçĺ­ \type{\line}ďźĺŽçĺŽ˝ĺşŚćŻĺ˝ĺćŽľč˝çĺŽ˝ĺşŚďźĺŻčŽŠĺśä¸­çćĺ­ĺä¸¤čžšäź¸ĺąĺšśä¸čžšçĺŻšé˝ďźäžĺŚ

\starttyping[option=TEX]
\line{\darkred\bf ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă}
\stoptyping
\line{\darkred\bf ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă}

çĺ°ä¸čż°ç¤şäžďźćłĺżä˝&nbsp;ćłčľˇäşäšĺćäťŹćžĺ¨ćçŤ&nbsp;ć&nbsp;é˘çć&nbsp;ˇĺźčŽžĺŽćśďźç¨ \type{{middle,broad}} ćĺśç \ConTeXt\ č§Śĺćąĺ­é´éçäź¸éżçšć§ďźčŻĽçšć§ä¸\type{\line} çććéĺ¸¸ç¸äźźă

ä˝żç¨ \type{\hfill} ć \type{\hss} ĺŻĺŻšć¨Şĺçĺ­éçĺĺŽščżčĄć¤ĺăäžĺŚ

\starttyping[option=TEX]
\line{\hfill ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă}
\line{ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hfill}
\line{\hfill ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hfill}
\line{\hss ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă}
\line{ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hss}
\line{\hss ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hss}
\stoptyping

\blueframed{
  \vbox{
  \line{\hfill ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă}
  \line{ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hfill}
  \line{\hfill ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hfill}
  \line{\hss ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă}
  \line{ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hss}
  \line{\hss ćč˝ĺä¸çťçčä¸äź¤čşŤä˝ă\hss}
  }
}

\type{\hfill} ĺ \type{\hss}ďźé˝ćŻĺŻć&nbsp;éäź¸çźŠçç˛čżďźčżćä¸ä¸Şäź¸çźŠč˝ĺĺźąäş \type{\hfill} ç \type{\hfil}ăçŤĺçĺŻć&nbsp;éäź¸çźŠçç˛čżć \type{\vfil}ďź\type{\vfill} ĺ \type{\vss}ă

\section{\ConTeXt\ çĺ­}

ĺ¨ \ConTeXt\ ĺąé˘ďźéĺ¸¸ĺžĺ°ä˝żç¨ \TeX\ çĺ­ďźčćŻä˝żç¨ \type{\inframed} ĺ \type{\framed}ââĺčćŻĺčççšäžăä¸ \TeX\ çĺ­ç¸ćŻďź\ConTeXt\ ĺąé˘ççĺ­ĺŻäťĽćžç¤şčžšćĄďźä¸ćéĺ¸¸ĺ¤çĺć°ĺŻäťĽĺŽĺśĺŽäťŹçĺ¤č§ă

\type{\inframed} ç¨äşć­ŁćďźĺŻç¨äşçťä¸čĄćĺ­ĺ˘ĺ&nbsp;čžšćĄďźäžĺŚ

\starttyping[option=TEX]
\type{\inframed{\type{\inframed{...}}}}
\stoptyping

\noindent çťćä¸ş \inframed{\type{\inframed{...}}}ăĺčĽä˝żç¨ \type{\framed}ďźäžĺŚ

\starttyping[option=TEX]
\type{\framed{\type{\framed{...}}}}
\stoptyping

\noindent çťćä¸ş \framed{\type{\framed{...}}}ăĺŻäťĽĺç°ďź\type{\inframed} ć´éĺĺ¨ć­Łćä¸­ä˝żç¨ďźĺ&nbsp;ä¸şĺŽč˝ä¸ćĺ­ĺşçşżĺŻšé˝ăäşĺŽä¸ďź\type{\inframed} ä¸ \type{\framed[location=low]} ç­ćďźćčĺčćŻĺčççšäžăäžĺŚ

\starttyping[option=TEX]
\framed[location=low]{\type{\framed[location=low]{...}}}
\stoptyping

\noindent çťćä¸ş \framed[location=low]{\type{\framed[location=low]{...}}}ă

ĺŚćä¸ĺ¸ć \type{\framed} ćžç¤şčžšćĄďźĺŞé \type{\framed[frame=off]{...}}ďźäšĺŻäťĽĺçŹćžç¤şććĄčžšçşżďźĺšśčŽžĺŽčžšçşżç˛ĺşŚĺé˘č˛ďź

\starttyping[option=TEX]
\line{
  \framed[frame=off,leftframe=on,rulethickness=4pt,framecolor=red]{foo}
  \framed[frame=off,topframe=on,rulethickness=4pt,framecolor=green]{foo}
  \framed[frame=off,rightframe=on,rulethickness=4pt,framecolor=blue]{foo}
  \framed[frame=off,bottomframe=on,rulethickness=4pt,framecolor=magenta]{foo}
}
\stoptyping
\line{
  \framed[frame=off,leftframe=on,rulethickness=4pt,framecolor=red]{foo}
  \framed[frame=off,topframe=on,rulethickness=4pt,framecolor=green]{foo}
  \framed[frame=off,rightframe=on,rulethickness=4pt,framecolor=blue]{foo}
  \framed[frame=off,bottomframe=on,rulethickness=4pt,framecolor=magenta]{foo}
}

\blank

ĺŻäťĽčŽžĺŽçĺ­çĺŽ˝ĺşŚĺéŤĺşŚďźäžĺŚĺŽ˝ 10cmďźéŤ 2 cm ççĺ­ďź

\starttyping[option=TEX]
\hbox to \textwidth{\hfill\framed[width=10cm,height=2cm]{foo}\hfill}
\stoptyping
\hbox to \textwidth{\hfill\framed[width=10cm,height=2cm]{foo}\hfill}

\section{ĺŻšé˝}

\ConTeXt\ çĺ­çĺĺŽšéťčŽ¤ĺąä¸­ďźĺł \type{align=center}ďźć­¤ĺ¤čżć 8 ç§ĺŻšé˝ćšĺźďź

\starttyping[option=TEX]
\line{
  \setupframed[width=1.95cm,height=1.95cm]
  \framed[align={flushleft,high}]{A}
  \framed[align={middle,high}]{A}
  \framed[align={flushright,high}]{A}
  \framed[align={flushright,lohi}]{A}
  \framed[align={flushright,low}]{A}
  \framed[align={middle,low}]{A}
  \framed[align={flushleft,low}]{A}
  \framed[align={flushleft,lohi}]{A}
}
\stoptyping
\line{
  \setupframed[width=1.95cm,height=1.95cm]
  \framed[align={flushleft,high}]{A}
  \framed[align={middle,high}]{A}
  \framed[align={flushright,high}]{A}
  \framed[align={flushright,lohi}]{A}
  \framed[align={flushright,low}]{A}
  \framed[align={middle,low}]{A}
  \framed[align={flushleft,low}]{A}
  \framed[align={flushleft,lohi}]{A}
}

\type{\setupframed} ćä˝çčŽžĺŽäźĺ˝ąĺĺ°ĺśĺçćć \type{\framed}ďźä˝ćŻä¸äźĺ˝ąĺĺ°ĺśćĺ¤çźçť\footnote{čżčŽ°ĺž \TeX\ çźçťĺďźĺł \type[escape=no]{{...}}ă}äšĺ¤ç \type{\framed}ă

\section{čćŻ}

ĺŻĺ°é˘č˛ä˝ä¸ş \type{\framed} çčćŻăäžĺŚ

\starttyping[option=TEX]
\inframed
  [background=color,
   backgroundcolor=lightgray,
   width=2cm,
   frame=off]{\bf foo}
\stoptyping

\noindent çťćä¸ş \inframed[background=color,backgroundcolor=lightgray,width=2cm,frame=off]{\bf foo}ă

éčż overlayďźĺŻĺ°ä¸äşäťŁç&nbsp;çćŽľçćççťćä˝ä¸ş \type{\framed} çčćŻăäžĺŚ

\starttyping[option=TEX]
\defineoverlay
  [foo]
  [{\framed[width=3cm,frame=off,bottomframe=on]{}}]
\midaligned{\inframed[background=foo,frame=off]{ä˝&nbsp;ĺĽ˝ĺďź}}
\stoptyping

\defineoverlay
  [foo]
  [{\framed[width=3cm,frame=off,bottomframe=on]{}}]
\midaligned{\inframed[background=foo,frame=off]{ä˝&nbsp;ĺĽ˝ĺďź}}
\blank

éčżä¸čż°ç¤şäžďźç°ĺ¨ä˝&nbsp;ĺşčŻĽč˝ććä¸ĺŤĺćç˝ \in[item-sym-diy] čä¸­ĺ¸Śĺć°ĺ­ćŻĺŚä˝ĺŽç°çäşďźĺśĺłéŽäťŁç&nbsp;ĺŚä¸ďź

\starttyping[option=TEX]
\startuseMPgraphic{foo}
  path p;
  p := fullcircle scaled 12pt;
  draw p withpen pencircle scaled .4pt
         withcolor darkred;
\stopuseMPgraphic
\defineoverlay[rsquare][\useMPgraphic{foo}]
\def\fooframe#1{%
  \inframed[frame=off,background=rsquare]{#1}%
}
\stoptyping
\startuseMPgraphic{foo}
  path p;
  p := fullcircle scaled 12pt;
  draw p withpen pencircle scaled .4pt
         withcolor darkred;
\stopuseMPgraphic
\defineoverlay[rsquare][\useMPgraphic{foo}]
\def\fooframe#1{%
  \inframed[frame=off,background=rsquare]{#1}%
}
\noindent ć&nbsp;éćŻĺ°ä¸ä¸Şĺĺĺžĺ˝˘ä˝ä¸ş \type{\inframed} çčćŻç˝˘äşďźčä¸ĺŻšĺĺçćĺ­çéżĺşŚćéĺśďźĺ­ć°çĽĺ¤ä¸äşďźäžżĺşĺäşďźäžĺŚ \type{\fooframe{123}}ďźçťćä¸ş \fooframe{123}ăä¸čżďźĺŞéĺŻšä¸čż°äťŁç&nbsp;çĽĺ&nbsp;äżŽćšďź

\starttyping[option=TEX]
  p := fullcircle scaled \overlaywidth;
\stoptyping
\startuseMPgraphic{foo}
  path p;
  p := fullcircle scaled \overlaywidth;
  draw p withpen pencircle scaled .4pt
         withcolor darkred;
\stopuseMPgraphic
\defineoverlay[rsquare][\useMPgraphic{foo}]
\def\fooframe#1{%
  \inframed[frame=off,background=rsquare]{#1}%
}

\noindent äžżĺŻč§Łé¤čŻĽéĺśăćĺˇ§ćŻďźç¨ overlay çĺŽéĺŽ˝ĺşŚä˝ä¸şĺä˝ĺçćžĺ¤§ĺć°ďźćčĺŻäżčŻĺĺçç´ĺžĺłĺĺćĺ­çéżĺşŚďźäžĺŚ \type{\fooframe{ććä¸ä¸Şĺ¤§ćżĺ­}}ďźçťćä¸ş \fooframe{ććä¸ä¸Şĺ¤§ćżĺ­}ă

\section{çĺ­çćˇąĺşŚ}

ĺŚćä˝&nbsp;äťçťč§ĺŻďź\ConTeXt\ çĺ­éçĺĺŽšĺ¨ć°´ĺšłćšĺćŻç˛žçĄŽĺąä¸­çďźä˝ćŻĺ¨ĺšśéĺŚć­¤ăäžĺŚ

\starttyping[option=TEX]
\inframed{ajk\framed{ćçĺ°ä¸ćŁľć¨ąćĄć&nbsp;}}ă
\stoptyping

\noindent çťćä¸ş \inframed{\framed{ćçĺ°ä¸ćŁľć¨ąćĄć&nbsp;}}ăĺŻč§ \type{\inframed} ĺé¨ç \type{\framed} çĺşé¨ćççäźźĺ¤ä˝ççŠşç˝ăä˝żç¨çĺ­çĺć° \type{depth} ĺŻäťĽćśé¤čżäşçŠşç˝ďźä˝éŽé˘ĺ¨äşčżĺ¤çŠşç˝äťä˝čćĽĺĺśéŤĺşŚćŻĺ¤ĺ°ăčŻĽéŽé˘ä¸ĺşĺą \TeX\ çčĽżććçćşĺśćĺłă

éŚĺďźćäťŹéčŚćç˝ďźčĽżććçďźä¸čĄćĺ­ćŻćĺşçşżçďźä˝ĺşçşżĺšśéä˝äşčŻĽčĄćĺ­çćĺşçŤŻďźčćŻčˇćĺşçŤŻćä¸ćŽľčžĺ°çčˇçŚťďźĺŚĺććčĽżćĺ­ćŻé˝ĺ¨ĺä¸ćĄçşżä¸äşăĺ¨ä¸čż°ç¤şäžä¸­ďź\type{\framed} çĺşçşżäžżćŻĺśĺ¤ĺ´ç \type{\inframed} ćĺ¨čĄçĺşçşżăčĽżćĺ­ä˝ĺ¨čŽžčŽĄćśďźćŻä¸Şĺ­ĺ˝˘ďźGlyphďźćŻćĺşçşżä˝ç˝Žďźĺ&nbsp;ć­¤ĺ¨ćçćśĺŻć&nbsp;šćŽĺŽéçĺşçşżä˝ç˝ŽĺŻšĺ­ĺ˝˘čżčĄĺŻšé˝ăä¸čĄćĺ­çĺşçşżĺ°čŻĽčĄçćĺşçŤŻçčżćŽľčˇçŚťç§°ä¸şćˇąĺşŚăä¸čĄćĺ­çĺşçşżĺ°čŻĽčĄćéĄśçŤŻçčżćŽľčˇçŚťç§°ä¸şéŤĺşŚăĺ&nbsp;ć­¤ďźä¸čĄćĺ­ççć­ŁéŤĺşŚç­äşćˇąĺşŚ + éŤĺşŚďźĺ¨ \ConTeXt\ ä¸­ďźĺŽç­äşćäťŹä˝żç¨ \type{\setupinterlinespace} čŽžĺŽçĺ°şĺŻ¸ă

ć&nbsp;čŽşćŻ \TeX\ čżćŻ \ConTeXt\ çĺ­ďźĺŽäťŹćŹčşŤćŻć˛ĄććˇąĺşŚçďźä˝ćŻĺ˝ĺŽäťŹéé˘çćĺ­ćçĺ­ććˇąĺşŚćśďźĺŽäťŹäžżćäşćˇąĺşŚăčłäşćˇąĺşŚĺźĺˇä˝ćŻĺ¤ĺ¤§ďźĺŻäťĽĺĺŠ \TeX\ ççĺ­ĺŻĺ­ĺ¨čżčĄćľéăäžĺŚďźĺŽäšä¸ä¸Şçĺ­ĺŻĺ­ĺ¨ box0ďź

\starttyping[option=TEX]
\setbox0\hbox{\inframed{\framed{ćçĺ°ä¸ćŁľć¨ąćĄć&nbsp;}}}
\stoptyping
\setbox0\hbox{\inframed{\framed{ćçĺ°ä¸ćŁľć¨ąćĄć&nbsp;}}}

\noindent ç°ĺ¨ćäťŹćäşä¸ä¸Ş 0 ĺˇçĺ­ďźä˝żç¨ \type{\wd}ďź\type{\ht} ĺ \type{\dp} ĺŻĺĺŤćľéčŻĽçĺ­çĺŽ˝ĺşŚăéŤĺşŚĺćˇąĺşŚâŚâŚéĄşäžżĺ¤äš&nbsp;ä¸ä¸čĄ¨ć&nbsp;źçç¨ćłďź

\startsample
\starttabulate[|c|c|c|]
\HL
\NC ĺŽ˝ĺşŚ \NC éŤĺşŚ \NC ćˇąĺşŚ \NC\NR
\HL
\NC \the\wd0 \NC \the\ht0 \NC \the\dp0 \NC\NR
\HL
\stoptabulate
\stopsample
\simplesample[option=TEX]{\getsample}

ĺ°ä¸čż°ćĺžćˇąĺşŚäżĄćŻĺč´ä˝ä¸ş \type{\inframed} çĺć° \type{depth} çĺźďźĺł

\starttyping[option=TEX]
\inframed[depth=-\dp0]{\framed{ćçĺ°ä¸ćŁľć¨ąćĄć&nbsp;}}
\stoptyping

\noindent äžżĺŻćśé¤ćˇąĺşŚďźçťćä¸ş \inframed[depth=-\dp0]{\framed{ćçĺ°ä¸ćŁľć¨ąćĄć&nbsp;}}ă

\section{ĺ°çť}

\TeX\ çĺ­ćŻć&nbsp;ĺ˝˘çă\ConTeXt\ çĺ­ćŻćĺ˝˘çăčĺ­ćžčŻ´čżďźćć&nbsp;ćŹ˛ďźäťĽč§ĺśĺŚďźćććŹ˛ďźäťĽč§ĺśćĺžźăćčďź\TeX\ čŚćä¸äşďź\ConTeXt\ äščŚćä¸äşă
</pre></body></html>