ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Strange bug with overviewpage module.
Date: Sat, 20 Dec 2014 00:51:41 -0500 (EST)	[thread overview]
Message-ID: <alpine.OSX.2.02.1412200044430.90646@nqv-znpobbx> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 908 bytes --]

Hi,

Some time ago, Hans had helped me to write an 'overviewpage' module, that 
makes it easy to show a overview of the important slides at the end of a 
presentation. I have tweaked this module slightly to be able to save an 
arbitrary page by using

\saveoverviewpage{reference}

and reuse the page by

\useoverviewpage{reference}

An example is:

\usemodule[overviewpage]
\setuppapersize[S4]

\setupframedtext[rulethickness=3pt]

\starttext

\startframedtext
   \input ward
\stopframedtext
\saveoverviewpage{ward}
\page

\input tufte
\page

\scale[width=0.5\textwidth]{\useoverviewpage{ward}}

\stoptext


However, when I save a page that contains a framed box (as in the above 
example), the box looses its right frame when it is displayed again (see 
page 3 of the attached pdf). It appears that the left edge is twice as 
thick.

Any idea why this is happening and how I can avoid this?

Thanks,
Aditya

[-- Attachment #2: Type: APPLICATION/pdf, Size: 11510 bytes --]

[-- Attachment #3: Type: TEXT/PLAIN, Size: 3941 bytes --]

%D \module
%D   [     file=t-overviewpage,
%D      version=2013.08.31,
%D        title=\CONTEXT\ User Module,
%D     subtitle=Page Overviews,
%D       author=Aditya Mahajan and Hans Hagen,
%D         date=\currentdate,
%D    copyright=Aditya Mahajan,
%D        email=adityam <at> ieee <dot> org,
%D      license=Simplified BSD License]

\writestatus{loading}{Overview Page (ver: 2013.08.31)}

\startmodule [overviewpage]

\unprotect

\setupmodule
  [\c!level=]

\installnamespace{overviewpage}

\initializeboxstack{\????overviewpage}

\newconditional\c_overviewpage_state

\unexpanded\def\enablesaveoverviewpage
  {\global\settrue\c_overviewpage_state}

\unexpanded\def\saveoverviewpage#1%
  {\enablesaveoverviewpage
   \setevalue{\????overviewpage:page:#1}{\the\realpageno}}

\unexpanded\def\useoverviewpage#1%
  {\writestatus{overviewpage}{using page #1 (\getvalue{\????overviewpage:page:#1})}%
   \expanded{\foundbox{\????overviewpage}{\getvalue{\????overviewpage:page:#1}}}}

\unexpanded\def\overviewpage_save_page#1%
  {\ifconditional\c_overviewpage_state
     \setbox\nextbox\hbox{#1}%
     \setbox\scratchbox\copy\nextbox
     \cleanupbox\scratchbox % remove nodes that should not be seen in the backend twice
     \writestatus{overviewpage}{saving overviewpage \the\realpageno}%
     \savebox{\????overviewpage}{\the\realpageno}{\box\scratchbox}%
     \global\setfalse\c_overviewpage_state
     \page_shipouts_normal{\box\nextbox}%
   \else
     \page_shipouts_normal{#1}%
   \fi}

\appendtoks
    \doif {\headparameter{option:overviewpage}} \v!yes \enablesaveoverviewpage
\to \everyheadsynchronization

\installshipoutmethod{overviewpage}\overviewpage_save_page

\unexpanded\def\overviewpage_setup_head#1%
  {\setuphead[#1][option:overviewpage=\v!yes]}

\appendtoks
    \processcommacommand
      [\moduleparameter{overviewpage}\c!level]
      \overviewpage_setup_head
\to \everysetupmodule


\the\everysetupmodule

\setuppaper
  [\c!method=overviewpage]

\definelistalternative
  [overviewpage]
  [\c!renderingsetup=\??listrenderings:overview]

\setuplistalternative
  [overviewpage]
  [\c!before=\dontleavehmode,
   \c!after=\hskip\zeropoint\relax,
 % \c!width=\ctxlua{moduledata.overviewpage.calculatedwidth(\listlength)}]
   \c!width=\ctxlua{moduledata.overviewpage.calculatedwidth(structures.lists.size())}]

\startsetups[\??listrenderings:overview]
    \doifboxelse{\????overviewpage}{\structurelistrealpagenumber}
       {\listalternativeparameter\c!before
        \startcurrentlistentrywrapper
          \scale
            [\c!width=\listalternativeparameter\c!width]
            {\foundbox{\????overviewpage}{\structurelistrealpagenumber}}%
        \stopcurrentlistentrywrapper
        \listalternativeparameter\c!after}
       {}%
\stopsetups

\definemakeup
  [overviewpage]
  [\c!align=\v!middle]

\definelayout
  [overviewpage]
  [\v!page]

\startluacode
    moduledata              = moduledata              or { }
    moduledata.overviewpage = moduledata.overviewpage or { }

    function moduledata.overviewpage.calculatedwidth(pages)
        context("%f\\textwidth",1/math.ceil(math.sqrt(pages)))
    end
\stopluacode

% Ideally, we would like to simply use the definition below. 
% However, the `before` and `after` keys are not used with `\placecombinedlist`. 
% Therefore we use a more manual solution.
%
\definecombinedlist
    [overviewpage]
    [\moduleparameter{overviewpage}\c!level]
    [
      %\c!before=\startoverviewpagemakeup,
      %\c!after=\stopoverviewpagemakeup,
      \c!criterium=\v!all,
      \c!alternative=overviewpage,
    ]

\unexpanded\def\placeoverviewpage
  {\dosingleargument\doplaceoverviewpage}

\def\doplaceoverviewpage[#1]%
  {\startoverviewpagemakeup
      \placecombinedlist[overviewpage][#1]
   \stopoverviewpagemakeup}

\protect

\stopmodule

[-- Attachment #4: 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:[~2014-12-20  5:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-20  5:51 Aditya Mahajan [this message]
2014-12-20  6:14 ` Otared Kavian
2014-12-20  7:20   ` Aditya Mahajan
2014-12-21 13:21     ` Otared Kavian
2014-12-21 18:50       ` Aditya Mahajan
2014-12-21 20:00         ` jdh
2014-12-21 23:03           ` Aditya Mahajan
2014-12-23  9:06         ` Otared Kavian

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=alpine.OSX.2.02.1412200044430.90646@nqv-znpobbx \
    --to=adityam@umich.edu \
    --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).