Changes

Jump to navigation Jump to search
m
Text replacement - "</cmd>" to "}}"
In [http://source.contextgarden.net/tex/context/base/core-mis.mkii core-mis.mkii] ([http://source.contextgarden.net/tex/context/base/core-mis.mkiv core-mis.mkiv] for MkIV) there are some handy You can use the commands for graphical text manipulation defined, but also for graphics or other “building blocks”.
== \scale =Scaling=
You can insert symbols at a reduced size in the text flow. This example creates a filled square scaled to .5 ex height
<texcodecontext source=yes>\definefontsynonym[Dingbats][uzdr]\definesymbol[filledSq][\getglyphgetscaledglyph{.5}{DingbatsSerif}{\char110a}]\defa \FilledSquare% getscaledglyph{\dontleavehmode\scale[height=0.5ex]2}{\symbol[filledSq]Serif}{a}</texcodecontext>
In TeX terms, \scale creates a \hbox. If TeX is in vertical mode (as it is when \startlines is in effect, because every lineis a paragraph by itself in the mode), then a simple \hbox is not a good enough hint to make it switch to horizontal (paragraph) mode.  Hans then posted a simpler way.<texcode>\getscaledglyph{.5}{Serif}{a}</texcode> {{todo|An explanation and example of the <cmd>scale</cmd> command.}} =Mirroring = \mirror == <texcodecontext source=yes>There is a \mirror{\sl mirorred} word in this sentence.</texcode> <context>There is a \mirror{\sl mirorredword} word in this sentence.
</context>
<code>\mirror</code> makes a <code>\hbox</code> and mirrors the contents. If you want to have a longer paragraph mirrored, you have to make a <code>\vbox</code> manually.
<texcode>\mirror{\vbox{Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?'}}</texcode>  <contextsource=yes>
\mirror{\vbox{Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do:
once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and
</context>
== \rotate =Rotating =
You can rotate something by an arbitrary angle by saying something like
\rotate{the ultimate answer}
</context>
 
==Location parameter==
An example by Hans Hagen showing the influence of <code>location=</code> argument at different angles:
You can rotate a long paragraph as well.
{{todo|Some more comments, and an example.}}==In a box==
Depending on the usage you will sometimes probably want to include the content of what you wish to rotate into a box. Compare the following two examples:
<texcodecontext source=yes>
\setuplayout[width=3cm]
\setuprotate[rotation=180,location=broad]
a\rotate{e}i\par
a\rotate{\hbox{e}}i
</context>
 
==Page dependent landscape figures==
 
Sometimes, in a double-sided portrait document, you may wish to rotate a landscape figure so that the top is towards the spine of the book – no matter whether it's on an odd or even page. In this case the {{cmd|doifoddpageelse}} command can help:
 
<texcode>
\rotate[rotation=\doifoddpageelse{90}{270}]{\externalfigure[cow]}
</texcode>
<This example is by Wolfgang, from [http://www.ntg.nl/pipermail/ntg-context>\setuplayout[width=3cm]\setuprotate[rotation=180,location=broad/2011/059834.html the thread starting here]. The thread contains other solutions to the problem.
a\rotate{e}i\para\rotate{\hbox{e}}i</context>=Clipping=
== \clip ==(This is not just about text manipulation...)You can adjust the size of an element by cropping/clipping its borders:
<context source="yes">
\clip[nx=3,ny=3,x=1,y=1]{\externalfigure[cow]}
</context>
 
<context source="yes">
</context>
see also <{{cmd>|setupclipping</cmd> }} and <{{cmd>|clip<}} =Further reading= In [https:/cmd>/source.contextgarden.net/tex/context/base/mkii/core-mis.mkii core-mis.mkii] (for MkII), there are some handy commands for graphical text manipulation defined. {{todo|What is the equivalent for mkiv ?}} [[Category:Basics]][[Category:Graphics]]

Navigation menu