From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/60124 Path: news.gmane.org!not-for-mail From: Michael Goerz Newsgroups: gmane.comp.tex.context Subject: Re: horizontal alignment Date: Sat, 10 Jul 2010 01:15:03 -0400 Message-ID: References: <4C370476.8010407@uni-ulm.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1278738914 6175 80.91.229.12 (10 Jul 2010 05:15:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Jul 2010 05:15:14 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Jul 10 07:15:13 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.69) (envelope-from ) id 1OXSP9-0005G2-N5 for gctc-ntg-context-518@m.gmane.org; Sat, 10 Jul 2010 07:15:11 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4EBBAC9C8E; Sat, 10 Jul 2010 07:15:10 +0200 (CEST) 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 XNBIPgUZAYRJ; Sat, 10 Jul 2010 07:15:06 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id CB1B5C9C7F; Sat, 10 Jul 2010 07:15:06 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A3C71C9A70 for ; Sat, 10 Jul 2010 07:15:05 +0200 (CEST) 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 ZTNzJqBPMBN6 for ; Sat, 10 Jul 2010 07:15:03 +0200 (CEST) Original-Received: from mail-fx0-f41.google.com (mail-fx0-f41.google.com [209.85.161.41]) by balder.ntg.nl (Postfix) with ESMTP id 811E9C9C7F for ; Sat, 10 Jul 2010 07:15:03 +0200 (CEST) Original-Received: by fxm20 with SMTP id 20so1697314fxm.14 for ; Fri, 09 Jul 2010 22:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=Fh7/wGNUUzWKgvEw9uNMjESJ9eKk4Tv/IMb2ocqQCQ0=; b=ALopORK0GSkm9v6nSDBLivm3/fKU398WE6sDrh0HMhurJIp/fldN5fUB91+i6jqLjL GF4FGanfUO3KO9giWbD5ftsO5E/vfe+0XlbcY1ezJO6Plujz+EUscmWchVA46XFZe5yO 4KWneTuzmZLW1IMW9P/LpnObPvTQzy9GmNUOo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=eFLCmpZ2+oLQo5kZ99+vgIgLY+N/zCHR4MfOsHOmK0lgra/PIRTllPebptSlkkQ9JX OANXbQxzEZzTI5ZJBYhS/HHDMam46o8vkV27aruHFJqdfoO5u1TLNE1R3G5ZeJsTwSgS ZgbJ6J8w57gALhrYtqm1IAx+KCBbfwtUu6r1U= Original-Received: by 10.103.182.1 with SMTP id j1mr123730mup.119.1278738903215; Fri, 09 Jul 2010 22:15:03 -0700 (PDT) Original-Received: by 10.103.231.11 with HTTP; Fri, 9 Jul 2010 22:15:03 -0700 (PDT) In-Reply-To: <4C370476.8010407@uni-ulm.de> X-Google-Sender-Auth: d4oU3SgaLU6BdWFGcHZ0q7gsJ4U 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:60124 Archived-At: On Fri, Jul 9, 2010 at 7:13 AM, Michael Murphy wrote: > On 09/07/10 01:32, Michael Goerz wrote: >> I'm trying to do some horizontal alignment, for typesetting poetry. >> How would you solve this kind of problem? I've considered defining a >> macro \BrokenLine[line1][line2] that does the above. But, there are >> also instances where there are two or more lines as a continuation of >> one previous line. Maybe there is a possibility to mark a horizontal >> position temporarily, and then jump to that position later? > > Anyway, this is a crappy solution and you could probably make it better. As > far as I'm aware, there is no way to get the current horizontal position > across the page at any particular moment. The method below essentially just > measures the length of the line that you want to enter, and sets this as the > indent. > > \dimendef\indentl=10 > > \def\savewidth#1{% > \setbox0=\hbox{#1}% > \copy0% > \indentl=\wd0% > } > > \def\addtosavewidth#1{% > \setbox0=\hbox{#1}% > \mindent\copy0% > \advance\indentl by \wd0% > } > > \def\mindent{\hskip\indentl} Thanks, Michael, that works great! Just out of interest: why does \savewidth create a newline if there's more text on the same line, (like this: \savewidth{start of line} and some more text ) while \addtosavewidth does not? The difference is the \hskip in front of the \copy0%; if I add \hskip0pt in front of the the \copy in \savewidth, there's also no newline -- but how does that make sense? Michael ___________________________________________________________________________________ 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 ___________________________________________________________________________________