Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

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.

share|improve this answer
    
Thank you. Why this way is better? –  Mustafa Oct 16 '12 at 13:32
2  
Because 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. –  Marco Oct 16 '12 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.

illustration of emphases

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.