On Thu, Jun 12, 2008 at 05:26:41PM +0200, Werner LEMBERG wrote:

> 
> [Cc'ing this interesting question to the CJK mailing list and to
> Heiko, the maintainer of the hyperref package]
> 
> 
> > sorry if this is going through improper channels, but I recently
> > took up TeX in order to rewrite my book on Japanese grammar, and
> > discovered that while the "ruby" package is well suit for ruby in
> > print, it leads to problems in books that stay available in pdf form
> > - the problem has to do with how the text is structured: the TeX
> > declaration "This is a \ruby{document}{text}\ using ruby markup"
> 
> [Cf. http://de.wikipedia.org/wiki/Ruby-Markup]
> 
> > becomes the pdf string "this is a text document using ruby markup",
> > so that searching for "This is a document using ruby markup" will
> > fail. Are there any plans to update the ruby package in such a way
> > that ruby markup is not part of the 'main' paragraph text, but
> > simply boxed between lines, with glue appropriately added in the
> > paragraph line and the ruby line?
> 
> Honestly, I don't know how to do that easily.  Additionally, I don't
> think that the `simply boxed between lines' is a good concept.  I
> could imagine that \ruby{document}{text} should be output as `text
> (document)' or something.

Rather "document (text)" with "document" as ruby base and "text"
as ruby text?

> Heiko, is this possible?

\newcommand*{\ruby}[2]{#1 (#2)}

or

\newcommand*{\ruby}[2]{%
  [EMAIL PROTECTED]@{}}%
    text\\%
    document\\%
  \end{tabular}%
}

(But searching remains problematic.)

or with ActualText:

\documentclass{article}

\usepackage{accsupp}
\usepackage{hyperref}

\newcommand*{\rubystack}[2]{%
  [EMAIL PROTECTED]@{}}%
    {#1}\\%
    {#2}\\%
  \end{tabular}%
}

\newcommand*{\ruby}[2]{%
  \mbox{%
    \rubystack{%
      \phantom{#2}%
    }{%
      #1%
    }%
    \BeginAccSupp{method=pdfstringdef,ActualText={ (#2)},}% 
    % \BeginAccSupp{method=plain,ActualText={}}% supresses ruby text
    \llap{%
      \rubystack{%
        #2%
      }{%
        \phantom{#1}%
      }%
    }%
    \EndAccSupp{}%
  }%
}   
 
\begin{document}
This is a \ruby{document}{text} using ruby markup.
\end{document}

Yours sincerely
  Heiko <[EMAIL PROTECTED]>

_______________________________________________
Cjk maillist  -  [email protected]
https://lists.ffii.org/mailman/listinfo/cjk

Reply via email to