ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Vit Zyka <vit.zyka@seznam.cz>
Subject: baseline alignment
Date: Thu, 22 Jul 2004 10:59:31 +0200	[thread overview]
Message-ID: <40FF81F3.1060406@seznam.cz> (raw)

Hallo,

for text positioning in a layer I needed alignment to baseline. I do not 
known if I missed something but I did not find it in the current 
ConTeXt. So I did that. Baseline is choosen by capital 'B' in the 
position parameter. ('B' is adopted from grahicx LaTeX/plain package.)

Also I add \ctop, \ltop, and \rtop in sence of \cbox, \lbox, and rbox, 
respectively.

I suggest to add the macros to core-box and supp-box.

Vit Zyka

%-------------------------------------------- baseline alignment
\setvalue{\??ab\??ab  B}{\baselinebox}
\setvalue{\??ab\??ab  Bl}{\baselineleftbox}
\setvalue{\??ab\??ab  Bc}{\baselinecenterbox}
\setvalue{\??ab\??ab  Br}{\baselinerightbox}
\setvalue{\??ab\??ab  lB}{\leftbaselinebox}
\setvalue{\??ab\??ab  cB}{\centerbaselinebox}
\setvalue{\??ab\??ab  rB}{\rightbaselinebox}
\def\baselinecenterbox#1%
   {\normalhbox
      {\setbox0\placedbox{#1}%
       \global\boxhdisplacement-.5\wd0
       \global\advance\boxhdisplacement-\boxoffset
       \global\boxvdisplacement-\boxoffset
       \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
\def\baselineleftbox#1%
   {\normalhbox
      {\setbox0\placedbox{#1}%
       \global\boxhdisplacement-\wd0
       \global\advance\boxhdisplacement-\boxoffset
       \global\boxvdisplacement-\boxoffset
       \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
\def\baselinerightbox#1%
   {\normalhbox
      {\setbox0\placedbox{#1}%
       \global\boxhdisplacement\boxoffset
       \global\boxvdisplacement-\boxoffset
       \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
\let\baselinebox=\baselinecenterbox
\let\leftbaselinebox=\baselineleftbox
\let\rightbaselinebox=\baselinerightbox

%------------------------------ \ltop, \rtop, \ctop
\def\lrctop#1#2#%
   {\vtop#2\bgroup
    \let\\=\endgraf
    \forgetall#1\let\next=}
\def\ltop{\lrctop\raggedleft}
\def\rtop{\lrctop\raggedright}
\def\ctop{\lrctop\raggedcenter}

             reply	other threads:[~2004-07-22  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-22  8:59 Vit Zyka [this message]
2004-08-09 22:39 ` Hans Hagen
2004-09-09 14:36   ` Vit Zyka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40FF81F3.1060406@seznam.cz \
    --to=vit.zyka@seznam.cz \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).