ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Partial \framed
Date: Mon, 06 Jun 2016 12:32:30 +0200	[thread overview]
Message-ID: <5755513E.7030604@gmail.com> (raw)
In-Reply-To: <57553049.7020300@fehige.de>


[-- Attachment #1.1: Type: text/plain, Size: 2521 bytes --]

> Thomas Fehige <mailto:thomas@fehige.de>
> 6. Juni 2016 um 10:11
> I'm trying to put a piece of text in a partial frame that's meant to 
> look like square brackets aligned with the left and right edges of the 
> textblock.
>
> I tried to use two \framed constructions inside each other, the outer 
> one with width=textwidth and negative toffset and boffset, the inner 
> one with a smaller width, a fat rulethickness and the color of the 
> background, expecting it to erase the outer frame where it's not needed:
>
> \color[zier]{%
>
> \framed[%
>
> align=middle,
>
> width=\textwidth,
>
>                         toffset=-4mm,
>
> boffset=-4mm,
>
> strut=no,
>
> ]{%
>
> \color[paper]{\framed[%
>
> align=middle,
>
> width=222mm, % i.e. \textwidth-4mm
>
>                                 toffset=6mm,
>
> boffset=5mm,
>
> rulethickness=5mm
>
> ]{%
>
> \color[zier]{\tfd \strut Here's the text that is menat to look 
> important; its length/number of lines is undetermined.\strut}
>
> }}%
>
> }%
>
> }%
>
> ... but it doesn't work. Apparently the inner frame is drawn before 
> the outer one. Putting the wider frame inside the narrower results in 
> alignment problems --  due to the overfull hbox, I presume.
Your example is of not much use because it can’t be converted to a PDF 
(missing \starttext and empty lines).
> Is  there a simple solution in ConTeXt that I haven't found yet, or 
> will I have to try some plain TeX box magic myself?
You can use MetaPost to draw the frame/lines for the left and right borders.

\startuseMPgraphic{leftbracket}
     z[0] = (EmWidth,OverlayHeight) ;
     z[1] = (0,OverlayHeight) ;
     z[2] = (0,0) ;
     z[3] = (EmWidth,0) ;
     draw z[0]--z[1]--z[2]--z[3] withcolor \MPcolor{\overlaylinecolor} ;
\stopuseMPgraphic

\startuseMPgraphic{rightbracket}
     z[0] = (-EmWidth,OverlayHeight) ;
     z[1] = (0,OverlayHeight) ;
     z[2] = (0,0) ;
     z[3] = (-EmWidth,0) ;
     draw z[0]--z[1]--z[2]--z[3] withcolor \MPcolor{\overlaylinecolor} ;
\stopuseMPgraphic

\installleftframerenderer {bracket}{\useMPgraphic {leftbracket}}
\installrightframerenderer{bracket}{\useMPgraphic{rightbracket}}

\defineframed
   [bracketframed]
   [frame=off,
    offset=1ex,
    leftframe=bracket,
    rightframe=bracket,
    framecolor=red,
    foregroundstyle=\ssx,
    foregroundcolor=darkgray,
    align=normal,
    width=max]

\starttext
\bracketframed{\input knuth }
\stoptext

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 4064 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2016-06-06 10:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-29 10:35 issue in the wiki Pablo Rodriguez
2016-05-29 15:31 ` Mohammad Hossein Bateni
2016-05-29 16:36   ` Letterspacing Thomas Fehige
2016-05-29 16:49     ` Letterspacing Hans Hagen
2016-05-31  8:31   ` issue in the wiki Pablo Rodriguez
2016-06-06  8:11     ` Partial \framed Thomas Fehige
2016-06-06 10:32       ` Wolfgang Schuster [this message]
2016-06-06 12:14         ` Thomas Fehige
2016-06-06 14:04           ` basic fontsizes question Thomas Fehige
2016-06-06 14:05           ` Thomas Fehige
2016-06-06 14:20             ` Thomas Fehige
2016-06-06 20:48             ` Wolfgang Schuster
2016-06-08  8:35               ` Thomas Fehige
2016-06-08  9:11                 ` Wolfgang Schuster
2016-06-08 12:40                   ` Thomas Fehige

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=5755513E.7030604@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --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).