From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/36987 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: How to realize rubytext in Context? Date: Sun, 14 Oct 2007 13:46:03 +0200 Message-ID: <20071014134603.6f9ef96c.schuster.wolfgang@googlemail.com> References: <200710132037.37375.tralalas@freenet.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Sun__14_Oct_2007_13_46_03_+0200_EVJV_3h/XAzRw9XK" X-Trace: ger.gmane.org 1192362431 1256 80.91.229.12 (14 Oct 2007 11:47:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Oct 2007 11:47:11 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 14 13:47:00 2007 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Ih1vv-0004nP-DE for gctc-ntg-context-518@m.gmane.org; Sun, 14 Oct 2007 13:46:59 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AC5D91FC16; Sun, 14 Oct 2007 13:46:52 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 21622-02-8; Sun, 14 Oct 2007 13:46:42 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 609061FB31; Sun, 14 Oct 2007 13:46:42 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 47AC81FB31 for ; Sun, 14 Oct 2007 13:46:36 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20687-03-7 for ; Sun, 14 Oct 2007 13:46:29 +0200 (CEST) Original-Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by ronja.ntg.nl (Postfix) with ESMTP id B1C5C1FB4E for ; Sun, 14 Oct 2007 13:46:29 +0200 (CEST) Original-Received: by ug-out-1314.google.com with SMTP id h2so782166ugf for ; Sun, 14 Oct 2007 04:46:29 -0700 (PDT) Original-Received: by 10.66.219.20 with SMTP id r20mr6633706ugg.1192362389085; Sun, 14 Oct 2007 04:46:29 -0700 (PDT) Original-Received: from rover ( [62.180.200.59]) by mx.google.com with ESMTPS id z37sm1820105ikz.2007.10.14.04.46.23 (version=SSLv3 cipher=OTHER); Sun, 14 Oct 2007 04:46:26 -0700 (PDT) In-Reply-To: <200710132037.37375.tralalas@freenet.de> X-Mailer: Sylpheed 2.4.7 (GTK+ 2.10.14; i686-pc-mingw32) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:36987 Archived-At: This is a multi-part message in MIME format. --Multipart=_Sun__14_Oct_2007_13_46_03_+0200_EVJV_3h/XAzRw9XK Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 13 Oct 2007 20:37:35 +0200 Peter Schorsch wrote: > Hi, > > for an multilanguage document I need to write some rubytext. But I have no > idea how to realize this in context. Math-mode is not a solution as the > line-breaks with longer rubytext - but maybe it is the only way. Hints are > very welcome. > > Here is a good and short explanation what rubytext is: > > http://www.w3.org/International/questions/qa-ruby > > Ciao, P. Hi Peter, you can try to use one of my modules for ruby typesetting, I never finished any of them but I hope I will do this in the future with support for simple and complex ruby. The file wolf-jap is the oldest version, the file wolf-newjap should be replacement for this file and js-ruby is a version I used myself only in plain XeTeX, none of the module take care at the moment of overlapping rubys or semthing else, just ruby text above the base text. If you need something special in the ruby command you can write to me by private mail and I will add it. Wolfgang --Multipart=_Sun__14_Oct_2007_13_46_03_+0200_EVJV_3h/XAzRw9XK Content-Type: text/x-tex; name="js-ruby.tex" Content-Disposition: attachment; filename="js-ruby.tex" Content-Transfer-Encoding: 7bit \def\rubyfont{\rm} \newtoks\rubybase \newtoks\rubytext \newdimen\rubywidth \def\startRUBY {\bgroup} \def\stopRUBY {\setbox0\hbox{\rubyfont\strut\the\rubytext\unskip}% \setbox1\hbox{\strut\the\rubybase\unskip}% \ifdim\wd0>\wd1 \rubywidth\wd0 \else \rubywidth\wd1 \fi \vbox {\offinterlineskip \hbox to\rubywidth{\hss\box0\hss}% \hbox to\rubywidth{\hss\box1\hss}}% \egroup} \def\startRB#1\stopRB{\rubybase{#1}} \def\startRT#1\stopRT{\rubytext{#1}} \def\ruby#1#2% {\startRUBY \startRB#1\stopRB \startRT#2\stopRT \stopRUBY} \endinput --Multipart=_Sun__14_Oct_2007_13_46_03_+0200_EVJV_3h/XAzRw9XK Content-Type: text/x-tex; name="wolf-jap.tex" Content-Disposition: attachment; filename="wolf-jap.tex" Content-Transfer-Encoding: quoted-printable %D \module %D [ file=3Dwolf-jap, %D version=3D20xx.xx.xx, %D title=3D\CONTEXT\ User Module, %D subtitle=3DJapanese, %D author=3DWolfgang Schuster, %D date=3D\currentdate, %D copyright=3DWolfgang Schuster] \writestatus{loading}{Context User Module / Japanese} \unprotect %D Systemvariable \def\????rb{@@@@rb} % RuBy %D Setup for rubyenvironment \def\setupruby% {\dosingleempty\dosetupruby} \def\dosetupruby[#1]% {\getparameters[\????rb][#1]} %D Ruby definition \def\ruby% {\dosingleempty\doruby} \def\doruby[#1]#2#3% Zeichen unter Rubybase im Moment nicht unterst=FCtzt {\dontleavehmode \bgroup \getparameters[\????rb][#1]% \offinterlineskip \edef\localstrut{\@@@@rbstrut}% \edef\rubysize {\switchtobodyfont[\the\dimexpr\@@@@rbscale\bodyfontsize= \relax]}% \setbox0=3D\hbox{#2}\dimen0=3D\wd0 \setbox1=3D\hbox{\rubysize#3}\dimen1=3D\wd1 \ifdim\dimen0>\dimen1 \hbox to \dimen0 {\vbox {\hbox to \dimen0{\hss\ifx\localstrut\v!yes\strut\fi\box1\hss} \doifvalue{\@@@@rbdistance}{\vskip\@@@@rbdistance} \hbox{\ifx\localstrut\v!yes\strut\fi\box0}}}\space% \else %\hbox to \dimen1 % {\vbox % {\hbox{\box1} % \vskip-0.7ex % \hbox to \dimen1{\hss\ifx\localstrut\v!yes\strut\fi\box0\hss}}}% \hbox to \dimen0 {\vbox {\hbox to \dimen0{\rubysize\hss\ifx\localstrut\v!yes\strut\fi\box= 1\hss} \doifvalue{\@@@@rbdistance}{\vskip\@@@@rbdistance} \hbox{\ifx\localstrut\v!yes\strut\fi\box0}}}\space% \fi \egroup \ignorespaces} %D A few examples %D %D Text text text %D \ruby{ruby base}{ruby text} %D text text text %D \ruby[scale=3D0.7,strut=3Dno,distance=3D]{ruby base}{ruby text} %D text text text %D=20 %D Text text text %D \ruby{ruby base}{ruby text} %D text text text %D \ruby[strut=3Dno]{ruby base}{ruby text} %D text text text %D=20 %D Text text text %D \ruby{ruby base}{very long ruby text} %D text text text %D \ruby[scale=3D0.8,strut=3Dno,distance=3D]{ruby base}{very long ruby text} %D text text text %D Default values \setupruby [\c!distance=3D-0.7ex, \c!scale=3D0.6, \c!strut=3D\v!yes] \protect \endinput --Multipart=_Sun__14_Oct_2007_13_46_03_+0200_EVJV_3h/XAzRw9XK Content-Type: text/x-tex; name="wolf-newjap.tex" Content-Disposition: attachment; filename="wolf-newjap.tex" Content-Transfer-Encoding: 7bit %D \module %D [ file=wolf-jap, %D version=20xx.xx.xx, %D title=\CONTEXT\ User Module, %D subtitle=Japanese, %D author=Wolfgang Schuster, %D date=\currentdate, %D copyright=Wolfgang Schuster] \unprotect \startconstants all overhang: overhang \stopconstants \def\????rb{@@@@rb} \newdimen\rubywidth \newsignal\rubysignal \def\setupruby {\dodoubleargument\getparameters[\????rb]} \def\startRUBY {\dosingleempty\dostartRUBY} \def\dostartRUBY[#1]% {\dontleavehmode \bgroup \iffirstargument \setupruby[#1]% \fi \ifdim\lastskip=\rubysignal \def\@@@@rboverhang{no}% \fi} \def\startRB#1\stopRB {\setbox1=\hbox{#1}} \def\startRT#1\stopRT {\setbox0=\hbox{#1}} \def\stopRUBY {\dimen0=\wd0 \multiply\dimen0 by\@@@@rbscale \divide\dimen0 by 1000 \dimen1=\wd1 \ifdim\dimen0>\dimen1 \ifx\@@@@rboverhang\v!yes \rubywidth=\dimen1 \else \rubywidth=\dimen0 \fi \else \rubywidth=\dimen1 \fi \vbox {\hbox\!!to\rubywidth %{\hss\switchtobodyfont[\dimexpr\@@@@rbscale\bodyfontsize\relax]\box0\hss} {\hss\box0\hss}% \hbox\!!to\rubywidth{\hss\small\box1\hss}}% \egroup \hskip\rubysignal} \setupruby [align=middle, overhang=yes, scale=500] \protect \endinput --Multipart=_Sun__14_Oct_2007_13_46_03_+0200_EVJV_3h/XAzRw9XK Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --Multipart=_Sun__14_Oct_2007_13_46_03_+0200_EVJV_3h/XAzRw9XK--