What is the equivalent of the LaTeX-code \textit{}
in ConTeX? It sets the text in the brackets italic. There is \it
but I am searching for something like \startit...\stopit
.
2 Answers
You can use \italic{some text}
. However it's better to not directly apply formatting to your text, use a logical markup instead.
\definehighlight
[emphasis]
[style=italic]
\emphasis{some text}
{\emphasis some text}
You should have a look at the user manual.
-
-
2Because it enables you to separate content and logical markup and the style and visual representation. Italic means italic, always. Emphasis can be represented as italic, bold, red, underlined. If you code you documents with logic markup you can apply a style file (sitting in an environment file) which results in a totally different representation of the content. Hard coded styles do not allow that. This is particularly useful when you use the XML export backend.– MarcoOct 16, 2012 at 13:36
Define an environment as usual (\definestartstop
) and set the style key:
%% environment:
\definestartstop[important][style=italic]
%% monadic macro:
\definehighlight[dontmiss] [style=italic]
\starttext
foo
\startimportant bar \stopimportant
baz
\dontmiss{xyzzy}
\stoptext
Btw. it is recommended to name you macros semantically, e.g. \important
or \keyword
instead of \italic
. This way you can adapt the style later by changing one parameter in the setup without having to mess with the content.
EDIT: In ConTeXt, the generic emphasis command is \emph
. With vanilla settings it defaults to slanted like the TeXbook. You can override the default via \setupbodyfontenvironment[default][em=italic]
. Now \emph{foo}
will be set in italics as well.