ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XeConTeXt and Euler
@ 2007-03-18 16:10 nicola
  2007-03-18 16:29 ` Aditya Mahajan
  2007-03-19  7:05 ` Fonts, nice looking headers, MetaFun and CV module Gudmundur J. Kristjansson
  0 siblings, 2 replies; 6+ messages in thread
From: nicola @ 2007-03-18 16:10 UTC (permalink / raw)
  To: ntg-context

Hi,
I'm pretty new to ConTeXt, so please bear with me if the following has 
already been asked (I have not found any answer in the archives, though).

My goal is to use an arbitrary text font together with the Euler math 
font. I am able to use a few combinations in ConTeXt, e.g. Palatino with 
Euler, without problems. But when I switch to XeConTeXt (to use my 
system's fonts), some Euler's math accents do not show up properly 
(\hat) or not at all (\acute, \grave, \bar, \breve, \dot, \ddot, \tilde, 
\check).

I guess the problem is the different encoding (and possibly the use of 
virtual fonts), but I know that Euler works in XeTeX: is it possible to 
make it work in XeConTeXt? Below you find my sample code.

Nicola

%!TEX TS-program = XeConTeXt
%!TEX encoding = UTF-8 Unicode

\definetypeface[Charis][rm][Xserif][Charis SIL][default][encoding=uc]
\definetypeface[Doulos][rm][Xserif][Doulos SIL][default][encoding=uc]
\definetypeface[Gentium][rm][Xserif][Gentium][default][encoding=uc]

\definetypeface[Charis][mm][math][euler][euler] % encoding???
\definetypeface[Doulos][mm][math][euler][euler]
\definetypeface[Gentium][mm][math][euler][euler]

\startbuffer
Unicode text works fine here, but formulas do not:
\startformula
\breve x^n + \bar y^n = \hat z^n.
\stopformula
\stopbuffer

\starttext
\switchtobodyfont[Charis] \getbuffer
\switchtobodyfont[Doulos] \getbuffer
\switchtobodyfont[Gentium] \getbuffer
\showmathcharacters
\stoptext
\end

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: XeConTeXt and Euler
  2007-03-18 16:10 XeConTeXt and Euler nicola
@ 2007-03-18 16:29 ` Aditya Mahajan
  2007-03-18 17:18   ` nicola
  2007-03-19  7:05 ` Fonts, nice looking headers, MetaFun and CV module Gudmundur J. Kristjansson
  1 sibling, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2007-03-18 16:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 18 Mar 2007, nicola wrote:

> Hi,
> I'm pretty new to ConTeXt, so please bear with me if the following has
> already been asked (I have not found any answer in the archives, though).
>
> My goal is to use an arbitrary text font together with the Euler math
> font. I am able to use a few combinations in ConTeXt, e.g. Palatino with
> Euler, without problems. But when I switch to XeConTeXt (to use my
> system's fonts), some Euler's math accents do not show up properly
> (\hat) or not at all (\acute, \grave, \bar, \breve, \dot, \ddot, \tilde,
> \check).

AFAIU, Euler does not have these accents. They are pulled from the 
text font. That is a bit tricky because different text encodings have 
accents at different locations. Right now, there is only suport for ec 
and texnansi. You can try to add support for uc encoding by telling 
ConTeXt about location of accents in uc encoding. Look at the code at 
the end of math-eul.tex

Aditya

> I guess the problem is the different encoding (and possibly the use of
> virtual fonts), but I know that Euler works in XeTeX: is it possible to
> make it work in XeConTeXt? Below you find my sample code.
>
> Nicola
>
> %!TEX TS-program = XeConTeXt
> %!TEX encoding = UTF-8 Unicode
>
> \definetypeface[Charis][rm][Xserif][Charis SIL][default][encoding=uc]
> \definetypeface[Doulos][rm][Xserif][Doulos SIL][default][encoding=uc]
> \definetypeface[Gentium][rm][Xserif][Gentium][default][encoding=uc]
>
> \definetypeface[Charis][mm][math][euler][euler] % encoding???
> \definetypeface[Doulos][mm][math][euler][euler]
> \definetypeface[Gentium][mm][math][euler][euler]
>
> \startbuffer
> Unicode text works fine here, but formulas do not:
> \startformula
> \breve x^n + \bar y^n = \hat z^n.
> \stopformula
> \stopbuffer
>
> \starttext
> \switchtobodyfont[Charis] \getbuffer
> \switchtobodyfont[Doulos] \getbuffer
> \switchtobodyfont[Gentium] \getbuffer
> \showmathcharacters
> \stoptext
> \end
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
>

-- 
Aditya Mahajan | EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam | Ph: 734.262.4008

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: XeConTeXt and Euler
  2007-03-18 16:29 ` Aditya Mahajan
@ 2007-03-18 17:18   ` nicola
  2007-03-18 18:17     ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: nicola @ 2007-03-18 17:18 UTC (permalink / raw)
  To: ntg-context

In article <alpine.WNT.0.83.0703181123410.3352@nqvgln>,
 Aditya Mahajan <adityam@umich.edu> wrote:

> On Sun, 18 Mar 2007, nicola wrote:
> > My goal is to use an arbitrary text font together with the Euler math
> > font. I am able to use a few combinations in ConTeXt, e.g. Palatino with
> > Euler, without problems. But when I switch to XeConTeXt (to use my
> > system's fonts), some Euler's math accents do not show up properly
> > (\hat) or not at all (\acute, \grave, \bar, \breve, \dot, \ddot, \tilde,
> > \check).
> 
> AFAIU, Euler does not have these accents. They are pulled from the 
> text font. That is a bit tricky because different text encodings have 
> accents at different locations. Right now, there is only suport for ec 
> and texnansi. You can try to add support for uc encoding by telling 
> ConTeXt about location of accents in uc encoding. Look at the code at 
> the end of math-eul.tex

Ok, I see. Where is \definemathsymbol documented? The third argument is 
not very clear to me.

Nicola

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: XeConTeXt and Euler
  2007-03-18 17:18   ` nicola
@ 2007-03-18 18:17     ` Aditya Mahajan
  0 siblings, 0 replies; 6+ messages in thread
From: Aditya Mahajan @ 2007-03-18 18:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 18 Mar 2007, nicola wrote:

> In article <alpine.WNT.0.83.0703181123410.3352@nqvgln>,
> Aditya Mahajan <adityam@umich.edu> wrote:
>
>> On Sun, 18 Mar 2007, nicola wrote:
>>> My goal is to use an arbitrary text font together with the Euler math
>>> font. I am able to use a few combinations in ConTeXt, e.g. Palatino with
>>> Euler, without problems. But when I switch to XeConTeXt (to use my
>>> system's fonts), some Euler's math accents do not show up properly
>>> (\hat) or not at all (\acute, \grave, \bar, \breve, \dot, \ddot, \tilde,
>>> \check).
>>
>> AFAIU, Euler does not have these accents. They are pulled from the
>> text font. That is a bit tricky because different text encodings have
>> accents at different locations. Right now, there is only suport for ec
>> and texnansi. You can try to add support for uc encoding by telling
>> ConTeXt about location of accents in uc encoding. Look at the code at
>> the end of math-eul.tex
>
> Ok, I see. Where is \definemathsymbol documented? The third argument is
> not very clear to me.

\definemathsymbol is defined in math-ini.tex. It has two versions, one 
with four arguments and one with six arguments. When using four 
arguments,
#1 = name of symbol to be defined
#2 = type of math atom (bin, rel, ord, punct, open, close, op, nothing)
#3 = font family. Usually,
      mi = math italic
      mr = math roman
      sy = symbol
      The actual fonts are defined using \definebodyfont (e.g. see
      type-siz)
#4 = hex code of the location of the symbol.

In math-eul #3 = tf (text font), so the accent is pulled from the text 
font. This is usually ugly, but there is no other option since Euler 
is not a complete math font family.

I am not sure when 6 argument version of definemathsymbol is used.

Aditya

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Fonts, nice looking headers, MetaFun and CV module
  2007-03-18 16:10 XeConTeXt and Euler nicola
  2007-03-18 16:29 ` Aditya Mahajan
@ 2007-03-19  7:05 ` Gudmundur J. Kristjansson
  2007-03-19 18:08   ` Wolfgang Schuster
  1 sibling, 1 reply; 6+ messages in thread
From: Gudmundur J. Kristjansson @ 2007-03-19  7:05 UTC (permalink / raw)
  To: ntg-context

Hi.

I'm been huffing and puffing the last few days trying to do my CV in 
ConTeXt. My previous version used the LaTeX Curve package and I was 
pretty happy with that.

I'm learning alot by doing this myself but some things have been pretty 
hard. The hardest: trying to some kind of fancy section headers. I'm 
pretty sure I should have been able to do this with the available 
documentation but I've read and read and not been able to find a 
solution.

Here's some of the things that my little brain can't comprehend:

1. I'm thoroughly confused about how fonts work. From various 
documents I found some that worked, for example:

\definetypeface [zapf] [cg] [calligraphy] [chancery]
\switchtotypeface [zapf] [12pt,cg]

or 

\setupbodyfont[ber,pos]

But I can't seem to find any place that lists the fonts I can use or 
how this actually works. Is there any standardized way, for example, 
to change font in headers or definitions of commands to affect only 
text in those definitions?

2. Fancy header with half of the text in background color (see headers 
in my former pdf at http://www.vitum.net/gjk/cv.pdf). 

I tried various things here. Using \framed, MetaFun and \setupbackground. 
For example:

\setupbackground
    [leftoffset=0.3cm,
     rightoffset=0.3cm
     topoffset=-0.5cm,
     bottomoffset=0.3cm,
     background=color,
     backgroundcolor=red]

I guess I'm misunderstanding the offset parameters.

3. Framed texts with titles:

As explained in the MetaFun manual (Section 4.6, page 236) I tried 
using the code in that section...

\FrameTitle{Zapf (1)}
\StartFrame
Coming back to the use of typefaces in electronic
publishing: many of the new typographers receive their
knowledge and information about the rules of typography from
books, from computer magazines or the instruction manuals
which they get with the purchase of a PC or software.
\StopFrame

\startuseMPgraphic{FunnyFrame}
  picture p ; numeric w, h, o ;
  p := textext.rt(\MPstring{FunnyFrame}) ;
  w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
  p := p shifted (2o,h-ypart center p) ; draw p ;
  drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
  draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
  draw boundingbox p ;
  setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
defineframedtext[FunnyText][frame=off,background=FunnyFrame]
\def\StartFrame{\startFunnyText}
\def\StopFrame {\stopFunnyText }
\def\FrameTitle#1%
  {\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{FunnyFrame}{} % initialize the text variable

...and I have the following problems:
- The framing of the text is limited to a too narrow textwidth. I can't 
  seem to find where I change that in the code.
- Icelandic letters don't seem to work in titles or the text in the 
  frames. They do work in other places in the document, though.

Phew, that's enough for now. If any of you guys/gals have other ideas on 
how to do nice looking headers I'm open to everything.

Btw, I love using ConTeXt and really appreciate all your hard work.

P.S. Is there any CV package for ConTeXt out there? If not I could post 
my work (if people like what I did) to the ConTeXt wiki for others to use.

-- 
Best regards / Kær kveðja,
Gudmundur J. Kristjansson / Guðmundur J. Kristjánsson
gjk@vitum.net | gvendurjaki@gmail.com |
USA Tel. +347-821-9855.
Icelandic Tel. +354-893-4444.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fonts, nice looking headers, MetaFun and CV module
  2007-03-19  7:05 ` Fonts, nice looking headers, MetaFun and CV module Gudmundur J. Kristjansson
@ 2007-03-19 18:08   ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2007-03-19 18:08 UTC (permalink / raw)
  To: ntg-context

On Mon, 19 Mar 2007 03:05:16 -0400
"Gudmundur J. Kristjansson" <gjk@vitum.net> wrote:

> Hi.
> 
> I'm been huffing and puffing the last few days trying to do my CV in 
> ConTeXt. My previous version used the LaTeX Curve package and I was 
> pretty happy with that.
> 
> I'm learning alot by doing this myself but some things have been pretty 
> hard. The hardest: trying to some kind of fancy section headers. I'm 
> pretty sure I should have been able to do this with the available 
> documentation but I've read and read and not been able to find a 
> solution.
> 
> Here's some of the things that my little brain can't comprehend:
> 
> 1. I'm thoroughly confused about how fonts work. From various 
> documents I found some that worked, for example:
> 
> \definetypeface [zapf] [cg] [calligraphy] [chancery]
> \switchtotypeface [zapf] [12pt,cg]
> 
> or 
> 
> \setupbodyfont[ber,pos]
> 
> But I can't seem to find any place that lists the fonts I can use or 
> how this actually works. Is there any standardized way, for example, 
> to change font in headers or definitions of commands to affect only 
> text in those definitions?
> 
> 2. Fancy header with half of the text in background color (see headers 
> in my former pdf at http://www.vitum.net/gjk/cv.pdf). 
> 

Hi Gudmundur,

below is a very simple solution to your problem.

\unprotect

\def\cvsection#1#2%
  {\bgroup
     \setbox\scratchbox\hbox{#2}%
     \!!dimena\dimexpr\ht\scratchbox+\dp\scratchbox\relax
     \lower\dp\scratchbox\hbox\!!to\zeropoint
       {\startcolor[darkgray]
        \vrule\c!height.5\!!dimena\c!width\hsize\hss
        \stopcolor}%
     \midaligned{\box\scratchbox}
   \egroup}

\protect

\setupcolors[state=start]

\setuphead
  [section]
  [command=\cvsection,
   textstyle=\ss\bf]

\starttext

\section{Work experience}

\stoptext

Wolfgang

> I tried various things here. Using \framed, MetaFun and \setupbackground. 
> For example:
> 
> \setupbackground
>     [leftoffset=0.3cm,
>      rightoffset=0.3cm
>      topoffset=-0.5cm,
>      bottomoffset=0.3cm,
>      background=color,
>      backgroundcolor=red]
> 
> I guess I'm misunderstanding the offset parameters.
> 
> 3. Framed texts with titles:
> 
> As explained in the MetaFun manual (Section 4.6, page 236) I tried 
> using the code in that section...
> 
> \FrameTitle{Zapf (1)}
> \StartFrame
> Coming back to the use of typefaces in electronic
> publishing: many of the new typographers receive their
> knowledge and information about the rules of typography from
> books, from computer magazines or the instruction manuals
> which they get with the purchase of a PC or software.
> \StopFrame
> 
> \startuseMPgraphic{FunnyFrame}
>   picture p ; numeric w, h, o ;
>   p := textext.rt(\MPstring{FunnyFrame}) ;
>   w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
>   p := p shifted (2o,h-ypart center p) ; draw p ;
>   drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
>   draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
>   draw boundingbox p ;
>   setbounds currentpicture to unitsquare xyscaled(w,h) ;
> \stopuseMPgraphic
> 
> defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
> defineframedtext[FunnyText][frame=off,background=FunnyFrame]
> \def\StartFrame{\startFunnyText}
> \def\StopFrame {\stopFunnyText }
> \def\FrameTitle#1%
>   {\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
> \setMPtext{FunnyFrame}{} % initialize the text variable
> 
> ...and I have the following problems:
> - The framing of the text is limited to a too narrow textwidth. I can't 
>   seem to find where I change that in the code.
> - Icelandic letters don't seem to work in titles or the text in the 
>   frames. They do work in other places in the document, though.
> 
> Phew, that's enough for now. If any of you guys/gals have other ideas on 
> how to do nice looking headers I'm open to everything.
> 
> Btw, I love using ConTeXt and really appreciate all your hard work.
> 
> P.S. Is there any CV package for ConTeXt out there? If not I could post 
> my work (if people like what I did) to the ConTeXt wiki for others to use.
> 
> -- 
> Best regards / Kær kveðja,
> Gudmundur J. Kristjansson / Guðmundur J. Kristjánsson
> gjk@vitum.net | gvendurjaki@gmail.com |
> USA Tel. +347-821-9855.
> Icelandic Tel. +354-893-4444.
> 
> 
> 
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-03-19 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-18 16:10 XeConTeXt and Euler nicola
2007-03-18 16:29 ` Aditya Mahajan
2007-03-18 17:18   ` nicola
2007-03-18 18:17     ` Aditya Mahajan
2007-03-19  7:05 ` Fonts, nice looking headers, MetaFun and CV module Gudmundur J. Kristjansson
2007-03-19 18:08   ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).