[racket] Scribble document with accented characters

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jun 22 13:43:18 EDT 2014

I get that error with

 #lang scribble/base
 For instance, if I want a @(string-normalize-nfd "ä")?

I expect htat I'd get the same error by writing "ä" in decomposed form
in the source (i.e., a sequence of two Unicode code points), but my
mail reader and input methods generate composed forms.

In other words, the problem is that Scribble doesn't handle decomposed
characters as it should. Ironically, as Ian says, Scribble currently
handles composed characters in a fairly general way by decomposing
them, but it does that character-by-character on composed characters.

Assuming that it's a pain to adjust your editor to generate composed
characters, you can work around the problem for now by explicitly
normalizing to composed form:

 #lang scribble/base
 For instance, if I want a @(string-normalize-nfc "ä")?

At Sun, 22 Jun 2014 11:39:12 -0400 (EDT), "J. Ian Johnson" wrote:
> Scribble has a huge but incomplete unicode to latex translation that I extended 
> a lot for my own purposes, with the ability to handle a few compose characters 
> like tilde and hat. (Oh, I see scribble does that now too)
> https://github.com/ianj/scribble-latex-utils/blob/master/unmap.rkt
> 
> Big case expression adapted from
> scribble-pkgs/scribble-lib/scribble/latex-render.rkt
> 
> You want to add a case [(#\u04D3) "\\\"a"] or simply [(#\ä) "\\\"a"].
> The E from Matthias's blob is handled by the #\u301 combiner. It probably isn't 
> getting the \" case because the string is already normalized to use \u04D3 
> instead of u\308u\097.
> 
> -Ian
> 
> ----- Original Message -----
> From: "Matthias Felleisen" <matthias at ccs.neu.edu>
> To: "Shriram Krishnamurthi" <sk at cs.brown.edu>
> Cc: users at racket-lang.org
> Sent: Sunday, June 22, 2014 11:24:48 AM GMT -05:00 US/Canada Eastern
> Subject: Re: [racket] Scribble document with accented characters
> 
> 
> Here is a tiny snippet from HtDP/2e (front matter) that uses accents: 
> 
> #lang scribble/manual
> 
> @bold{Acknowledgments}: We thank 
>  Prof. Robert Ordóñez,
>  Éric Tanter, 
>  and Roelof Wobben
> for comments on previous drafts of this second edition. 
> 
> 
> If you load this in DrRacket and run scribble/pdf and scribble/html, you get 
> the correct output. My commandline set up also renders things correctly. 
> 
> 
> 
> 
> On Jun 22, 2014, at 10:58 AM, Shriram Krishnamurthi wrote:
> 
> > What's the proper way to use accented characters in a Scribble
> > document? For instance, if I want a ä? Simply writing that character
> > results in the error
> > 
> >  Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.
> > 
> > on OS X using the default latex (/usr/texbin/latex).
> > 
> > Thanks,
> > Shriram
> > 
> > ____________________
> >  Racket Users list:
> >  http://lists.racket-lang.org/users
> 
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.