From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/55524 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: ntg-context Digest, Vol 67, Issue 18 Date: Tue, 12 Jan 2010 23:02:10 +0100 Message-ID: References: <4B4CAC63.50200@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: multipart/mixed; boundary=Apple-Mail-15--588794523 X-Trace: ger.gmane.org 1263333771 25701 80.91.229.12 (12 Jan 2010 22:02:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Jan 2010 22:02:51 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jan 12 23:02:43 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.50) id 1NUoor-0007ao-JA for gctc-ntg-context-518@m.gmane.org; Tue, 12 Jan 2010 23:02:33 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 05259C9BC5; Tue, 12 Jan 2010 23:02:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UDrDQFfT+zHR; Tue, 12 Jan 2010 23:02:28 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 90A05C9BAE; Tue, 12 Jan 2010 23:02:27 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BB2AEC9BAE for ; Tue, 12 Jan 2010 23:02:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Px6fVCzkJ73a for ; Tue, 12 Jan 2010 23:02:17 +0100 (CET) Original-Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by balder.ntg.nl (Postfix) with ESMTP id 32254C9B41 for ; Tue, 12 Jan 2010 23:02:15 +0100 (CET) Original-Received: by fg-out-1718.google.com with SMTP id 19so2321784fgg.2 for ; Tue, 12 Jan 2010 14:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:mime-version :content-type:subject:date:in-reply-to:to:references:message-id :x-mailer; bh=mNEaZImQTOrs7p81+vm+yUl0tny5xXHL+LHtqZyfoXs=; b=l2Fk9BLcFNechHXondW5ScVp9yRyWDgRGS/Jb6YZ99pRd3leHkTGJJ1KaYFhskjiga WqJ5hSIEcEQTvHZO2N6Nvu9EZZbZ7mT4n9zu+7biCyXG0GDm/nmcwbo97l7zF5bAPvoW RUQCXOBKgrtJe2W+UtOEZ0OGCXiAJpALVD4a0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; b=jpITPCvVfQk05dGoCETJDt4O8owpYyXy55R15k4dqrjrJb6XT+elqfvB+Baps/bgJd aXBDYg83xETkYr7zJO6KY+QCNFhVNNvF/pNij5ot80liNDJ32yR2G2uJf+5FZLNgFd4g m4iJcFa06T4FOFwmJU3qbUEoSbl/7n5lKWn6E= Original-Received: by 10.87.58.11 with SMTP id l11mr11534707fgk.67.1263333734395; Tue, 12 Jan 2010 14:02:14 -0800 (PST) Original-Received: from ?192.168.2.23? (p5B2945E1.dip.t-dialin.net [91.41.69.225]) by mx.google.com with ESMTPS id e3sm2683665fga.6.2010.01.12.14.02.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 12 Jan 2010 14:02:12 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.1077) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:55524 Archived-At: --Apple-Mail-15--588794523 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail-15--588794523 Content-Disposition: attachment; filename=position.tex Content-Type: application/octet-stream; x-unix-mode=0644; name="position.tex" Content-Transfer-Encoding: 7bit \usemodule[ruby] \usetypescript[modern-base] \setupbodyfont[modern-base] \setupinterlinespace[line=3.6ex] \starttext \dorecurse{100}{a b c d e f g h i \ruby{j}{text} k l m n o p q r s } %\dorecurse{100}{a b c d e f g h i \ruby{j}{text} k l m n o p q r s t u v } \stoptext --Apple-Mail-15--588794523 Content-Disposition: attachment; filename=t-ruby.tex Content-Type: application/octet-stream; x-unix-mode=0777; name="t-ruby.tex" Content-Transfer-Encoding: 7bit %D \module %D [ file=t-ruby, %D version=2009.12.13, %D title=\CONTEXT\ User Module, %D subtitle=Ruby Markup, %D author=Wolfgang Schuster, %D date=\currentdate, %D copyright=Wolfgang Schuster, %D email=schuster.wolfgang@googlemail.com, %D license=Public Domain] \writestatus{loading}{ConTeXt User Module / Ruby Markup} \unprotect %D simple ruby: %D %D \starttyping %D %D WWW %D World Wide Web %D %D \stoptyping %D %D complex ruby: %D %D \starttyping %D %D %D 10 %D 31 %D 2002 %D %D %D Month %D Day %D Year %D %D %D Expiration Date %D %D %D \stoptyping %D Constants \startinterface all \setinterfaceconstant {basestyle} {basestyle} \setinterfaceconstant {basecolor} {basecolor} \setinterfaceconstant {overhang} {overhang} \stopinterface \startinterface all \setinterfacevariable {letter} {letter} \setinterfacevariable {end} {end} \setinterfacevariable {inline} {inline} \stopinterface %D Namespace \def\????rb{@@@@rb} %D Additional registers \newdimen \!!rubywidth \newdimen \!!rubyleftmargin \newdimen \!!rubyrightmargin \newsignal\!!rubysignal \newcount \!!rubycount \newtoks \!!rubybase \newtoks \!!rubytext %D Helpers \newif\ifideograph \long\def\doifelseideograph#1% {\global\ideographtrue \handletokens#1\with\checkideograph \ifideograph \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} \def\doifinrangeelse#1#2#3% {\unless\ifnum#1<#2 \unless\ifnum#1>#3 \expandafter\expandafter\expandafter\firstoftwoarguments \else \expandafter\expandafter\expandafter\secondoftwoarguments \fi \else \expandafter\secondoftwoarguments \fi} \def\checkideograph#1% {\doifinrangeelse{`#1}{"3040}{"309F}\donothing {\doifinrangeelse{`#1}{"30A0}{"30FF}\donothing {\doifinrangeelse{`#1}{"31F0}{"31FF}\donothing {\doifinrangeelse{`#1}{"3400}{"4DFF}\donothing {\doifinrangeelse{`#1}{"4E00}{"9FFF}\donothing {\doifinrangeelse{`#1}{"AC00}{"D7A3}\donothing {\doifinrangeelse{`#1}{"F900}{"FAFF}\donothing {\doifinrangeelse{`#1}{"FF00}{"FFEF}\donothing {\doifinrangeelse{`#1}{"20000}{"2A6DF}\donothing {\doifinrangeelse{`#1}{"2F800}{"2FA1F}\donothing {\ideographfalse}}}}}}}}}}} %D \macros %D {setupruby} \def\setupruby {\dodoubleargument\getparameters[\????rb]} \def\rubyparameter#1{\csname\????rb#1\endcsname} %D \macros %D {pdfactualtext} \ifx\pdfactualtext\undefined \let\pdfactualtext\secondoftwoarguments \fi %D \macros %D {bRUBY,eRUBY,bRB,eRB,bRT,eRT} \def\bRUBY {\dosingleempty\dobRUBY} \def\dobRUBY[#1]% {\begingroup \iffirstargument \setupruby[#1]% \fi \scratchdimen\lastskip \ifdim\scratchdimen=\!!rubysignal\else\global\!!rubywidth\!!zeropoint\fi \global\advance\!!rubycount\plusone \xypos{rubyposition:\number\!!rubycount}% \doifmodeelse\v!first {\edef\rubyposition{\the\onepoint}}% {\edef\rubyposition{\the\dimexpr\MPx{rubyposition:\number\!!rubycount}-\MPx{text:\the\realpageno}\relax}}} \def\eRUBY {\setbox\scratchboxone\hbox{\doattributes\????rb\c!basestyle\c!basecolor{\the\!!rubybase}}% \setbox\scratchboxtwo\hbox{\doattributes\????rb\c!textstyle\c!textcolor{\the\!!rubytext}}% \scratchdimenone\wd\scratchboxone \scratchdimentwo\wd\scratchboxtwo %\scratchdimenthree\ifdim\scratchdimenone<\scratchdimentwo\space\scratchdimenone\else\scratchdimentwo\fi \scratchdimenthree\scratchdimenone \executeifdefined{\????rb:\c!align :\rubyparameter\c!align }{\getvalue{\????rb:\c!align :\v!auto }}% \executeifdefined{\????rb:\c!position:\rubyparameter\c!position}{\getvalue{\????rb:\c!position:\v!before}}% \executeifdefined{\????rb:\c!overhang:\rubyparameter\c!overhang}{\getvalue{\????rb:\c!overhang:\v!auto }}% \hskip\!!rubysignal\relax \endgroup} \def\bRB{\dodoubleempty\dobRB} \def\bRT{\dodoubleempty\dobRT} \def\dobRB[#1][#2]#3\eRB{\!!rubybase{#3}} \def\dobRT[#1][#2]#3\eRT{\!!rubytext{#3}} %D Alignment \def\RUBYdistributespace #1{\doifelseideograph{#1}{\processtokens{\hss }{\hss\hss}{\hss }{\hss\hss}{#1}}{\hss#1\hss}} \def\RUBYdistributeletter#1{\doifelseideograph{#1}{\processtokens{\relax}{\hss }{\relax}{\hss\hss}{#1}}{\hss#1\hss}} \setvalue{\????rb:\c!align:\v!space}% {\!!rubyleftmargin \zeropoint \!!rubyrightmargin\zeropoint \ifdim\scratchdimenone>\scratchdimentwo \setbox\scratchboxone\hbox to \scratchdimenone{\hss\box\scratchboxone\hss}% \setbox\scratchboxtwo\hbox to \scratchdimenone{\doattributes\????rb\c!textstyle\c!textcolor{\@EA\RUBYdistributespace\@EA{\the\!!rubytext}}}% \else \setbox\scratchboxone\hbox to \scratchdimentwo{\doattributes\????rb\c!basestyle\c!basecolor{\@EA\RUBYdistributespace\@EA{\the\!!rubybase}}}% \setbox\scratchboxtwo\hbox to \scratchdimentwo{\hss\box\scratchboxtwo\hss}% \fi} \setvalue{\????rb:\c!align:\v!letter}% {\!!rubyleftmargin \zeropoint \!!rubyrightmargin\zeropoint \ifdim\scratchdimenone>\scratchdimentwo \setbox\scratchboxone\hbox to \scratchdimenone{\hss\box\scratchboxone\hss}% \setbox\scratchboxtwo\hbox to \scratchdimenone{\doattributes\????rb\c!textstyle\c!textcolor{\@EA\RUBYdistributeletter\@EA{\the\!!rubytext}}}% \else \setbox\scratchboxone\hbox to \scratchdimentwo{\doattributes\????rb\c!basestyle\c!basecolor{\@EA\RUBYdistributeletter\@EA{\the\!!rubybase}}}% \setbox\scratchboxtwo\hbox to \scratchdimentwo{\hss\box\scratchboxtwo\hss}% \fi} \setvalue{\????rb:\c!align:\v!auto}% I need special alignments for the begin/end of the line!!! {\ifdim\scratchdimenone>\scratchdimentwo \getvalue{\????rb:\c!align:\v!space}% \else \ifdim\rubyposition=\!!zeropoint % begin of the line \getvalue{\????rb:\c!align:\v!left}% \else\ifdim\rubyposition=\the\dimexpr\textwidth-\scratchdimenthree\relax % end of the line \getvalue{\????rb:\c!align:\v!right}% \else \getvalue{\????rb:\c!align:\v!space}% \fi\fi \fi} \setvalue{\????rb:\c!align:\v!left}% {\ifdim\scratchdimenone>\scratchdimentwo \!!rubyleftmargin \zeropoint \!!rubyrightmargin\zeropoint \else \!!rubyleftmargin \zeropoint \!!rubyrightmargin\dimexpr\scratchdimentwo-\scratchdimenone\relax \fi \setbox\scratchboxone\hbox to \scratchdimenthree{\box\scratchboxone\hss}% \setbox\scratchboxtwo\hbox to \scratchdimenthree{\box\scratchboxtwo\hss}} \setvalue{\????rb:\c!align:\v!start}% {\getvalue{\????rb:\c!align:\v!left}} \setvalue{\????rb:\c!align:\v!center}% {\ifdim\scratchdimenone>\scratchdimentwo \!!rubyleftmargin \zeropoint \!!rubyrightmargin\zeropoint \else \!!rubyleftmargin \dimexpr(\scratchdimentwo-\scratchdimenone)/2\relax \!!rubyrightmargin\dimexpr(\scratchdimentwo-\scratchdimenone)/2\relax \fi \setbox\scratchboxone\hbox to \scratchdimenthree{\hss\box\scratchboxone\hss}% \setbox\scratchboxtwo\hbox to \scratchdimenthree{\hss\box\scratchboxtwo\hss}} \setvalue{\????rb:\c!align:\v!right}% {\ifdim\scratchdimenone>\scratchdimentwo \!!rubyleftmargin \zeropoint \!!rubyrightmargin\zeropoint \else \!!rubyleftmargin \dimexpr\scratchdimentwo-\scratchdimenone\relax \!!rubyrightmargin\zeropoint \fi \setbox\scratchboxone\hbox to \scratchdimenthree{\hss\box\scratchboxone}% \setbox\scratchboxtwo\hbox to \scratchdimenthree{\hss\box\scratchboxtwo}} \setvalue{\????rb:\c!align:\v!end}% {\getvalue{\v!ruby:\c!align:\v!right}} \setvalue{\????rb:\c!align:\v!edge}% modify to take care of overlap etc. {\ifdim\rubyposition=\zeropoint \getvalue{\????rb:\c!align:\v!left}% \else\ifdim\rubyposition=\the\dimexpr\textwidth-\scratchdimenthree\relax \getvalue{\????rb:\c!align:\v!right}% \else \getvalue{\????rb:\c!align:\v!center}% \fi\fi} %D Positioning \setvalue{\????rb:\c!position:\v!before}% {\setbox\scratchboxthree\vbox {\offinterlineskip \box\scratchboxtwo \rubyparameter\c!inbetween \box\scratchboxone}} \setvalue{\????rb:\c!position:\v!after}% {\setbox\scratchboxthree\vtop {\offinterlineskip \box\scratchboxone \rubyparameter\c!inbetween \box\scratchboxtwo}} \setvalue{\????rb:\c!position:\v!inline}% pure text to allow line breaks in the text {\setbox\scratchboxthree\box\voidbox \!!rubyleftmargin \zeropoint \!!rubyrightmargin\zeropoint \the\!!rubybase \rubyparameter\c!separator \rubyparameter\c!lefttext\the\!!rubytext\rubyparameter\c!righttext} %D Overhang \setvalue{\????rb:\c!overhang:\v!auto}% {\ifdim\!!rubywidth>\!!zeropoint \kern\dimexpr\!!rubyleftmargin+\!!rubywidth\relax \fi \box\scratchboxthree \global\!!rubywidth\!!rubyrightmargin} \setvalue{\????rb:\c!overhang:\v!start}% {\box\scratchboxthree\kern\!!rubyrightmargin \global\!!rubywidth\!!rubyrightmargin} \setvalue{\????rb:\c!overhang:\v!end}% {\ifdim\!!rubywidth>\!!zeropoint \kern\dimexpr\!!rubyleftmargin+\!!rubywidth\relax \else \kern\!!rubyleftmargin \fi \box\scratchboxthree \global\!!rubywidth\!!zeropoint} \setvalue{\????rb:\c!overhang:\v!none}% {\kern\!!rubyleftmargin\box\scratchboxthree\kern\!!rubyrightmargin \global\!!rubywidth\!!zeropoint} %D \macros %D {ruby} \def\ruby {\dosingleempty\doruby} \def\doruby[#1]#2#3% {\dobRUBY[#1]\bRB#2\eRB\bRT#3\eRT\eRUBY} %D Default values \setupruby [\c!position=\v!before, % before|after|inline \c!align=\v!auto, % auto|start|left|center|end|right|distribute-letter|distribute-space|line-edge \c!overhang=\v!auto, % auto|start|end|none \c!separator={ }, \c!lefttext=(, \c!righttext=), \c!inbetween={\blank[\v!small]}, \c!textstyle=\txx] \protect \endinput --Apple-Mail-15--588794523 Content-Disposition: attachment; filename=chord.tex Content-Type: application/octet-stream; x-unix-mode=0644; name="chord.tex" Content-Transfer-Encoding: quoted-printable \usemodule[ruby]=0A=0A= %\define[1]\chord{\bRUBY[position=3Dafter,align=3Dleft]\bRB\eRB\bRT#1\eRT\= eRUBY}=0A= \define[1]\chord{\dontleavehmode\ruby[position=3Dafter,align=3Dleft,inbetw= een=3D{\blank[medium]}]{}{#1}}=0A=0A\starttext=0A=0A\startlines=0A=0A= \chord{E}Cvet=20di=C5=A1e=C4=8D=20z=20\chord{H7}jutrom=20se=20= od\chord{cis}pre,=0A=0A\chord{A}sonce=20od\chord{E}pira=20o\chord{H}=C4=8D= i.=0A=0A\chord{E}Polje=20z=20vetrom=20v=20\chord{H7}plesu=20ziblje=20= \chord{cis}se.=0A=0AGos\chord{E}pod,=20pov\chord{H}sod=20vidim=20= \chord{E}Te.=0A=0A\stoplines=0A=0A\stoptext=0A= --Apple-Mail-15--588794523 Content-Disposition: attachment; filename=README Content-Type: application/octet-stream; x-mac-type=2A2A2A2A; x-mac-creator=48647261; x-unix-mode=0644; name="README" Content-Transfer-Encoding: 7bit Modulename : t-ruby Author : Wolfgang Schuster License : Public Domain Description ----------- The 'ruby' module allows users to write ruby annotations in ConTeXt. Usage ----- The module is loaded with the command: \usemodule[ruby] Ruby text can be set with the command: \ruby{base text}{ruy text} The layout of the base and ruby text could be changed with: \setupruby [basestyle=..., basecolor=..., textstyle=..., textcolor=...] Whether ruby text overlaps with the surrounding text or not can be configured with: \setupruby [overlap=yes|no] % default: yes The last option is the distance between the ruby and the base text: \setupruby [inbetween=...] % default: \blank[small] All of these parameters can also be changed for a single ruby command: \ruby[..,..=..,..]{...}{...} --Apple-Mail-15--588794523 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Am 12.01.2010 um 18:24 schrieb Aditya Mahajan: > On Tue, 12 Jan 2010, Vyatcheslav Yatskovsky wrote: >=20 >> Thanks for answers, friends! >>=20 >> I don't have ruby installed, so I try Mojca solution.> >=20 > Wolfgang's module is for writing Ruby annotations = (http://www.w3.org/TR/ruby), it is not require Ruby programming = language. I attached my last version of the module with two test files to show Vyatcheslav what Mojca meant with a optimized version of her code, the module provides the same as she showed by hidden from the user and customizable with different keys. Wolfgang --Apple-Mail-15--588794523 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --Apple-Mail-15--588794523--