[NTG-context] Exporting highlights

Idris Samawi Hamid ادريس سماوي حامد ishamid at colostate.edu
Mon Mar 16 15:34:08 CET 2015


Ok, I've made some progress:

On Sun, 15 Mar 2015 17:01:16 -0600, Idris Samawi Hamid ادريس سماوي حامد  
<ishamid at colostate.edu> wrote:

> ============export-highlight.tex==============
> \setupbackend
>    [export=yes,css=highlight.css]

\setupexport[cssfile=highlight.css]
\setupbackend[export=yes]

> \definehighlight[emphasis] [style=italic]
> \definehighlight[important][style=bold]
> \definehighlight[regular][style=\tf]
>
> \starttext
>
> \startchapter[title=Highlights]
> \startparagraph
> This is \emphasis{emphasis}. This is \important{important}. This is
> \regular{regular}.
>
> This is \emphasis{some emphasized text, with \regular{regular} in  
> between}.
>
> This is \important{some important text, with \regular{regular} in  
> between}.
> \stopparagraph
> \stopchapter
> \stoptext
> ===============================================
>
> In highlight.css (copied from export-sample.css and modified) I added
> these lines:
>
> ==================
> highlight [detail="emphasis"]{
> 	font-weight : italic ;
> }
>
> highlight [detail="important"]{
> 	font-weight : bold ;
> }
>
> highlight [detail="regular"]{
> 	font-weight : regular ;
> }
> ==================

Syntax correction (thanks Aditya!):

.highlight.emphasis {
   font-style: italic;
}

etc.

> Challenge 1:
> Neither export-highlight-tag.xhtml nor export-highlight-div.xhtml renders
> the highlights. What do we need to do?

For italic, see above. For bold, we need

font-weight: bold;

> Challenge 2:
> export-highlight-div.xhtml breaks the line before a highlight as well as
> after a highlight. What is missing here?

display: inline;

So here is exactly what we need:

.highlight.important {
    font-weight: bold;
   font-style: normal;
    display: inline;
}

.highlight.emphasis {
   font-weight: normal;
   font-style: italic;
   display: inline;
}

.highlight.regular {
   font-weight: normal;
   font-style: normal;
   display: inline;
}

Now export-highlight-div.xhtml renders in the browser exactly as in  
export-highlight.pdf.

This is progress: a first step!

Best wishes
Idris
-- 
Idris Samawi Hamid
Professor of Philosophy
Colorado State University
Fort Collins, CO 80523


More information about the ntg-context mailing list