From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/44700 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Equivalent of LaTeX \cancel? and Thanks! Date: Sun, 12 Oct 2008 16:17:35 +0200 Message-ID: <48F206FF.8090007@wxs.nl> References: 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: ger.gmane.org 1223821185 23887 80.91.229.12 (12 Oct 2008 14:19:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Oct 2008 14:19:45 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 12 16:20:41 2008 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 1Kp1oC-0005Rc-K3 for gctc-ntg-context-518@m.gmane.org; Sun, 12 Oct 2008 16:20:36 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6E0791FB6D; Sun, 12 Oct 2008 16:19:29 +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 03435-02-12; Sun, 12 Oct 2008 16:18:14 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6C2C61FADC; Sun, 12 Oct 2008 16:18:14 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0E3281FADB for ; Sun, 12 Oct 2008 16:18:12 +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 03435-02-11 for ; Sun, 12 Oct 2008 16:17:35 +0200 (CEST) Original-Received: from mail.pragma-ade.net (dsl-083-247-100-017.solcon.nl [83.247.100.17]) by ronja.ntg.nl (Postfix) with ESMTP id 25D9C1FB30 for ; Sun, 12 Oct 2008 16:17:35 +0200 (CEST) Original-Received: from [10.100.1.112] (unverified [10.100.1.11]) by controller-1 (SurgeMail 3.9e) with ESMTP id 992-1840426 for ; Sun, 12 Oct 2008 16:17:35 +0200 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) In-Reply-To: X-Originating-IP: 10.100.1.11 X-Authenticated-User: hagen@controller-1 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:44700 Archived-At: Benjamin R. Haskell wrote: > Hi all, > > I recently transitioned from LaTeX to ConTeXt. There was some particular > thing I needed to do (which escapes me at the moment) that was far, far > easier to do in ConTeXt than in LaTeX. And, as I've learned, I've found > that that's quite often the case. So, a huge thank you to everyone > involved. > > A couple hours ago I was annoyed that I couldn't find an equivalent for > the LaTeX 'cancel' environment/command/style(?)[1]. Now, I'm truly amazed > that 'cancel' required a whole package. > > After discovering that 'underline' and 'strikethrough' were implemented as > overlays, I quickly coded up the following: > > \startuseMPgraphic{MyCancel} > draw (0,.2*\overlayheight)--(\overlaywidth,\overlayheight); > \stopuseMPgraphic > \defineoverlay[mycancel][\useMPgraphic{MyCancel}] > > \def\cancel#1{\framed[background=mycancel,frame=off]{#1}} > > > Now, I'm sure this is not *quite* the right way to do it. The 'cancel'ed > items end up being placed too high on the line, and other spacings are > slightly off. But, taking a cue from underlining, I kept the MyCancel > graphic and tried: > > \definetextbackground > [cancel] > [location=text, > alternative=1, > background=mycancel] > % plus boilerplate for setting up \startcancel\stopcancel > > ....But, while composing this email, I found what I wanted, which still > isn't ``right'' in some sense: > > \def\cancel#1{\framed[background=mycancel,frame=off,width=fit,height=fit,strut=no]{#1}} > > I found the parameters for \framed. I'm still learning to Read The > Fantastic Manuals, but sent this anyway since I wanted to say thanks. \startuseMPgraphic{mpos:par:cancel} for i=1 upto nofmultipars : draw .2[llcorner multipars[i],ulcorner multipars[i]] -- .2[urcorner multipars[i],lrcorner multipars[i]] ; endfor ; \stopuseMPgraphic \definetextbackground[cancel][location=text,mp=mpos:par:cancel] \def\startcancel{\starttextbackground[cancel]} \def\stopcancel {\stoptextbackground} \def\cancel {\groupedcommand\startcancel\stopcancel} however, this is kind of fuzzy when you cross lines an alternative is to use: \definetextbackground[cancel][location=text,alternative=4,background=,frame=off] \definestartstop [cancel] [before={\starttextbackground[cancel]}, after=\stoptextbackground] however, there is a glitch in the drawing so you need a patch \startMPinclusions def draw_multi_pars = for i=1 upto nofmultipars : do_draw_par(multipars[i]) ; if boxgridtype= 1 : draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) ; % withcolor boxgridcolor ; elseif boxgridtype= 2 : draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,false) ; % withcolor boxgridcolor ; elseif boxgridtype= 3 : draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) ; % withcolor boxgridcolor ; draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) shifted (0,ExHeight) ; % withcolor boxgridcolor ; elseif boxgridtype= 4 : draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) shifted (0,ExHeight/2) ; % withcolor boxgridcolor ; elseif boxgridtype=11 : draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ; elseif boxgridtype=12 : draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,0,0) ; fi ; endfor ; enddef ; \stopMPinclusions (will be fixed in the next release) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________