The correct way to add emphasis to text using italics
I've seen in several articles on the Wiki, some differences about how this is done, and I'm confused about the differences: *Font_Switching* says: "There is a font switch \em to emphasize text. This is somewhat special: it does automatic italic correction and changes the alternative depending on the current alternative. For example, if the current font alternative is normal (i.e. upright), \em switches to slanted; and if the current font alternative is slanted, \em switches to normal." And using \definebodyfontenvironment[default][em=italic] to use italic instead of slanted; for OpenType fonts, recommends using \definefontfeature[default][default][itlc=yes] to also activate the italic correction. However, this seems not to work in x(ht)ml export. If you go to *Export*, it says: "Also note that switches like \em don’t translate into output structure, you need to \definehighlight[emph][style={\em}] and use as \emph{emphasized}." This is what I'm currently using. Other parts of the Wiki show a similar solution, but using style=italic, or style={\it}; I've seen others, but now I can't find them. Could you please guide me as to where is this documented in the manuals? Is there any particular reason to choose any of these approaches above the others? What is the recommended option if you want to have the \em properties for emphasized text, but works for BOTH pdf and x(h)tml export? Thank you for your time. -- Andrés Conrado Montoya Andi Kú andresconrado@gmail.com http://sesentaycuatro.com http://messier87.com http://chiquitico.org ---------------------------------------- Los fines no justifican los medios, porque la medida verdadera de nuestro carácter está dada por los medios que estamos dispuestos a utilizar, no por los fines que proclamamos. ---------------------------------------- “You develop an instant global consciousness, a people orientation, an intense dissatisfaction with the state of the world, and a compulsion to do something about it. From out there on the moon, international politics look so petty. You want to grab a politician by the scruff of the neck and drag him a quarter of a million miles out and say, ‘Look at that, you son of a bitch.’” — Apollo 14 astronaut Edgar Mitchell
On Wed, 21 Oct 2020, Andres Conrado Montoya wrote:
I've seen in several articles on the Wiki, some differences about how this is done, and I'm confused about the differences:
*Font_Switching* says: "There is a font switch \em to emphasize text. This is somewhat special: it does automatic italic correction and changes the alternative depending on the current alternative. For example, if the current font alternative is normal (i.e. upright), \em switches to slanted; and if the current font alternative is slanted, \em switches to normal." And using \definebodyfontenvironment[default][em=italic] to use italic instead of slanted; for OpenType fonts, recommends using \definefontfeature[default][default][itlc=yes] to also activate the italic correction. However, this seems not to work in x(ht)ml export.
Did you also see **Before you start...** section on that page: https://wiki.contextgarden.net/Font_Switching#Before_you_start_...
If you go to *Export*, it says: "Also note that switches like \em don’t translate into output structure, you need to \definehighlight[emph][style={\em}] and use as \emph{emphasized}." This is what I'm currently using. Other parts of the Wiki show a similar solution, but using style=italic, or style={\it}; I've seen others, but now I can't find them.
Could you please guide me as to where is this documented in the manuals? Is there any particular reason to choose any of these approaches above the others?
As far as PDF output is consider, both the font switch \em and the macro \emph defined using \definehighlight[emph][style=\em] are equivalent. You can test that: \definehighlight[emph][style=\em] \starttext Normal text. \emph{This is \emph{emphasized} test} Normal text. {\em This is {\em emphasized} test} \stoptext
What is the recommended option if you want to have the \em properties for emphasized text, but works for BOTH pdf and x(h)tml export?
The raw font switch \em is not exported to HTML while \definehighlight[emph] is. Aditya
participants (2)
-
Aditya Mahajan
-
Andres Conrado Montoya