ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Hiding the content (drawing empty boxes?)
@ 2005-07-07 21:45 Mojca Miklavec
  2005-07-07 21:57 ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2005-07-07 21:45 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

Hello,

Some TeX challenge (probably not solvable?): for gurus only.

Is there a way to somehow

\starthidden
...
\stophidden,

which would leave exactly the same amount of blank space as if the 
content would be typeset?

Adam suggested to use transparent font colour, but this doesn't solve 
the problem as this won't stop the images, frames and nested 
\color[red]{font color changing commands} being displayed.

I tried to adapt the macro \demobox from the TeXBOOK which processes 
token by token and draws an empty box instead of that token. It works 
perfectly as long as there is only plain text between the braces, but as 
soon there is something more complex, it breaks. This behaviour is 
probably to be expected, but I have no idea how to let all the commands 
do what they are expected to do and only prohibit placing any boxes with 
some content.

Thanks,
	Mojca


[-- Attachment #2: demobox.tex --]
[-- Type: text/x-tex, Size: 2672 bytes --]


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the portion of code adapted from the TeXBOOK, Excercise 11.5 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\dolist{\afterassignment\dodolist\let\next= }
\def\dodolist{\ifx\next\endlist\let\next\relax
  \else \\\let\next\dolist \fi
\next}
\def\endlist{\endlist}

\def\\{\if\space\next\ % assume that \next is unexpandable
\else\setbox0=\hbox{\next}\setbox1=\hbox{}%
  \dp1=\dp0\ht1=\ht0\wd1=\wd0\box1\fi}

\def\demobox#1{{\dolist#1\endlist}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setupframed[strut=no,offset=0pt]
\setupcolors[state=start]
\starttext

%%%%%%%%%%%%%%
% this works %
%%%%%%%%%%%%%%

\color[blue]{This works OK:}

bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \demobox{bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla} bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla

bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The examples below have some troubles %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\color[blue]{This is not 100\% properly aligned, but works:}\par
a\demobox{Tough exercise.}b\par
a\hbox{Tough exercise.}b\par
a\framed{\hbox{Tough exercise.}}b\par
a\framed{\demobox{Tough exercise.}}b\par
%a\demobox{\framed{Tough exercise.}}b\par % this doesn't work

a\externalfigure[cow]b\par
\color[blue]{This cow has shrinked:}\par
a\demobox{\externalfigure[cow]}b\par
a\framed{\externalfigure[cow]}b\par
\color[blue]{And this cow disappeared:}\par
a\framed{\demobox{\externalfigure[cow]}}b\par
% a\demobox{\framed{\externalfigure[cow]}}b\par % this doesn't work

\color[blue]{The commented stuff didn't even dare to compile.}

%\input tufte \demobox{{\input tufte }}\input tufte\par
%\input tufte \input tufte \input tufte

%\dorecurse{10}{bla }
%\demobox{\dorecurse{10}{bla }}
%\dorecurse{10}{bla }\par
%\dorecurse{10}{bla }
%\dorecurse{10}{bla }
%\dorecurse{10}{bla }

\stoptext


[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-07 21:45 Hiding the content (drawing empty boxes?) Mojca Miklavec
@ 2005-07-07 21:57 ` Hans Hagen
  2005-07-07 22:33   ` Mojca Miklavec
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2005-07-07 21:57 UTC (permalink / raw)


Mojca Miklavec wrote:
> Hello,
> 
> Some TeX challenge (probably not solvable?): for gurus only.
> 
> Is there a way to somehow
> 
> \starthidden
> ...
> \stophidden,
> 
> which would leave exactly the same amount of blank space as if the 
> content would be typeset?
> 
> Adam suggested to use transparent font colour, but this doesn't solve 
> the problem as this won't stop the images, frames and nested 
> \color[red]{font color changing commands} being displayed.
> 
> I tried to adapt the macro \demobox from the TeXBOOK which processes 
> token by token and draws an empty box instead of that token. It works 
> perfectly as long as there is only plain text between the braces, but as 
> soon there is something more complex, it breaks. This behaviour is 
> probably to be expected, but I have no idea how to let all the commands 
> do what they are expected to do and only prohibit placing any boxes with 
> some content.

well, how about:

\defineproperty[mojcas-secrets][layer][state=top]

\starttext

\input tufte

\startproperty[mojcas-secrets]\input knuth \stopproperty

\input tufte

\stoptext


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-07 21:57 ` Hans Hagen
@ 2005-07-07 22:33   ` Mojca Miklavec
  2005-07-07 23:13     ` Adam Lindsay
  0 siblings, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2005-07-07 22:33 UTC (permalink / raw)


Hans Hagen wrote:
> Mojca Miklavec wrote:
> 
>> Is there a way to somehow
>>
>> \starthidden
>> ...
>> \stophidden,
>>
>> which would leave exactly the same amount of blank space as if the 
>> content would be typeset?

> well, how about:
> 
> \defineproperty[mojcas-secrets][layer][state=top]
> 
> \starttext
> 
> \input tufte
> 
> \startproperty[mojcas-secrets]\input knuth \stopproperty
> 
> \input tufte
> 
> \stoptext

Great! Thank you, Hans.

That's "unfair" again:
it seems too easy to be possible, but it actually works ... -)

Just a hint: don't ever expect my secrets to be hidden that way. They 
are way too precious to be seen by others by simply switching them on 
again in Acrobat :)

Mojca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-07 22:33   ` Mojca Miklavec
@ 2005-07-07 23:13     ` Adam Lindsay
  2005-07-08  7:12       ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Adam Lindsay @ 2005-07-07 23:13 UTC (permalink / raw)


Mojca Miklavec said this at Fri, 8 Jul 2005 00:33:38 +0200:

>Just a hint: don't ever expect my secrets to be hidden that way. They 
>are way too precious to be seen by others by simply switching them on 
>again in Acrobat :)

It's not hidden in other PDF viewers, such as Apple's native one.
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-07 23:13     ` Adam Lindsay
@ 2005-07-08  7:12       ` Hans Hagen
  2005-07-08  8:40         ` Patrick Gundlach
  2005-07-08  9:23         ` Adam Lindsay
  0 siblings, 2 replies; 10+ messages in thread
From: Hans Hagen @ 2005-07-08  7:12 UTC (permalink / raw)


Adam Lindsay wrote:
> Mojca Miklavec said this at Fri, 8 Jul 2005 00:33:38 +0200:
> 
> 
>>Just a hint: don't ever expect my secrets to be hidden that way. They 
>>are way too precious to be seen by others by simply switching them on 
>>again in Acrobat :)
> 
> 
> It's not hidden in other PDF viewers, such as Apple's native one.

as long as it's only mojca's password that needs to be hidden, she can use:

\starttext

\input tufte

\startproperty[hidden]
     mojca's secret code hidden for adam's apple
\stopproperty

\input tufte

\stoptext

Hans

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-08  7:12       ` Hans Hagen
@ 2005-07-08  8:40         ` Patrick Gundlach
  2005-07-08  9:23         ` Adam Lindsay
  1 sibling, 0 replies; 10+ messages in thread
From: Patrick Gundlach @ 2005-07-08  8:40 UTC (permalink / raw)




> as long as it's only mojca's password that needs to be hidden, she can use:

Well, it is still in the pdf file, so I'd rather not store my
passwords there. 

Patrick
-- 
ConTeXt wiki and more: http://contextgarden.net

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-08  7:12       ` Hans Hagen
  2005-07-08  8:40         ` Patrick Gundlach
@ 2005-07-08  9:23         ` Adam Lindsay
  2005-07-08 10:50           ` Mojca Miklavec
  1 sibling, 1 reply; 10+ messages in thread
From: Adam Lindsay @ 2005-07-08  9:23 UTC (permalink / raw)


Hans Hagen said this at Fri, 8 Jul 2005 09:12:01 +0200:

>as long as it's only mojca's password that needs to be hidden

:)
Well, someone could cut-and-paste that invisible text...

But that certainly works better on Apple's Preview.app, and probably is
mostly appropriate for the intended use... (hiding stuff in
presentations, making them non-Acrobat/JS dependent)

Except that it doesn't seem to hide framed content.
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-08  9:23         ` Adam Lindsay
@ 2005-07-08 10:50           ` Mojca Miklavec
  2005-07-08 12:33             ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2005-07-08 10:50 UTC (permalink / raw)


Adam Lindsay wrote:
> Hans Hagen said this at Fri, 8 Jul 2005 09:12:01 +0200:
> 
> 
>>as long as it's only mojca's password that needs to be hidden

If I'm ever going to store my password in PDF files, I'll wait for 
pdfTeX support for password-protected files first :)

> :)
> Well, someone could cut-and-paste that invisible text...

The problem is not in cutting-and-pasting at all. If I make a 
presentation, people won't mind cutting and pasting on my computer while 
I talk. But as long as it is only supported by Adobe >= 6, it's only 
suboptimal. :(
If someone could hack the plain TeX macro, it would probably do exactly 
what I would expect it to do, but it doesn't sound easy at all.

> But that certainly works better on Apple's Preview.app, and probably is
> mostly appropriate for the intended use... (hiding stuff in
> presentations, making them non-Acrobat/JS dependent)
> 
> Except that it doesn't seem to hide framed content.

Tu sum it up:
- the adapted plain TeX trick with boxes doesn't place any content, but 
only works for plain text (not useful)
- \startproperty[mysecret] hides the content (works satisfactory in that 
view), but only works on Adebe Acrobat, not even in the Wiki
- \startproperty[hidden] works on more browsers, but has the same effect 
as making fonts transparent: it doesn't influence any rules, figures, 
... only fonts.


For those complaining that hiding doesn't work on other PDF viewers: 
Adobe also gives up (one of those nice "undocummented features", one 
could also call them bugs) if I try to save the resulting file as TXT. I 
just wanted to check if the hidden content will be saved, but I didn't 
manage to save anything anyway.

Thanks for all the comments,
	Mojca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-08 10:50           ` Mojca Miklavec
@ 2005-07-08 12:33             ` Hans Hagen
  2005-07-08 16:43               ` Mojca Miklavec
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2005-07-08 12:33 UTC (permalink / raw)


Mojca Miklavec wrote:

> Tu sum it up:
> - the adapted plain TeX trick with boxes doesn't place any content, but 
> only works for plain text (not useful)
> - \startproperty[mysecret] hides the content (works satisfactory in that 
> view), but only works on Adebe Acrobat, not even in the Wiki
> - \startproperty[hidden] works on more browsers, but has the same effect 
> as making fonts transparent: it doesn't influence any rules, figures, 
> ... only fonts.
> 
> 
> For those complaining that hiding doesn't work on other PDF viewers: 
> Adobe also gives up (one of those nice "undocummented features", one 
> could also call them bugs) if I try to save the resulting file as TXT. I 
> just wanted to check if the hidden content will be saved, but I didn't 
> manage to save anything anyway.

i've added printable support (was already there but no key available)

\setupinteraction[state=start]

\defineproperty [mojca] [layer] [state=stop]

\starttext

\input ward

\startproperty[mojca]I hate hacking TeX!\stopproperty

\input davis

\button{Show   Mojca's Secret}[VideLayer{mojca}]
\button{Hide   Mojca's Secret}[HideLayer{mojca}]
\button{Toggle Mojca's Secret}[ToggleLayer{mojca}]

\stoptext

the bad news is is that acrobat does not handle it (my guess is that such 
features don't work becausethey have no way of testing it)

Hans



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hiding the content (drawing empty boxes?)
  2005-07-08 12:33             ` Hans Hagen
@ 2005-07-08 16:43               ` Mojca Miklavec
  0 siblings, 0 replies; 10+ messages in thread
From: Mojca Miklavec @ 2005-07-08 16:43 UTC (permalink / raw)


Hans Hagen wrote:
> i've added printable support (was already there but no key available)
> 
> \setupinteraction[state=start]
> \defineproperty [mojca] [layer] [state=stop]
> 
> \starttext
> \input ward
> \startproperty[mojca]I hate hacking TeX!\stopproperty
> \input davis
> 
> \button{Show   Mojca's Secret}[VideLayer{mojca}]
> \button{Hide   Mojca's Secret}[HideLayer{mojca}]
> \button{Toggle Mojca's Secret}[ToggleLayer{mojca}]
> 
> \stoptext
> 
> the bad news is is that acrobat does not handle it (my guess is that 
> such features don't work becausethey have no way of testing it)
> 
> Hans

Here it works in both Adobe Acrobat Professional 6.0.1 and Adobe Reader 
7.0.1.

Thanks for those examples too,
	Mojca

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-07-08 16:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-07 21:45 Hiding the content (drawing empty boxes?) Mojca Miklavec
2005-07-07 21:57 ` Hans Hagen
2005-07-07 22:33   ` Mojca Miklavec
2005-07-07 23:13     ` Adam Lindsay
2005-07-08  7:12       ` Hans Hagen
2005-07-08  8:40         ` Patrick Gundlach
2005-07-08  9:23         ` Adam Lindsay
2005-07-08 10:50           ` Mojca Miklavec
2005-07-08 12:33             ` Hans Hagen
2005-07-08 16:43               ` Mojca Miklavec

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).