Vertically centered text in each page
Inspired by Aditya's "make a presentation in 40 commits" example, I have defined my own environment for slides. A part of it looks like this: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \startreusableMPgraphic{header:background} fill OverlayBox leftenlarged BackSpace rightenlarged CutSpace topenlarged TopSpace withcolor OverlayColor ; setbounds currentpicture to OverlayBox enlarged max(BackSpace,CutSpace) ; \stopreusableMPgraphic \defineoverlay[header:background][\reuseMPgraphic{header:background}] \define[2]\MySlide{\framed[ frame=off, background=header:background, backgroundcolor=orange, width=\textwidth, align=flushleft ]{#2}} \definehead[slide][subject] \setuphead[slide][ style=\ssb, command=\MySlide, color=white, page=yes, ] \starttext \startslide[title={Slide One}] \vfill text \vfill \stopslide \startslide[title={Slide Two}] \vfill text \vfill \stopslide \stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% As you see, I am using \vfill to have the text vertically centered. How do I setup the slide command to do that by default? I have tried putting {before,after,beforesection,aftersection}=\vfill in various combinations in \setuphead, but I cannot obtain the desired effect. Related to the code above, I have another question: if I remove the comma after page=yes, slides are not split into different pages. Is it normal that a comma is required at the end of an argument list? Nicola
On Fri, 19 Feb 2016 11:54:12 +0100
Nicola
How do I setup the slide command to do that by default? I have tried putting {before,after,beforesection,aftersection}=\vfill in various combinations in \setuphead, but I cannot obtain the desired effect.
\setuphead[slide][ style=\ssb, command=\MySlide, color=white, insidesection=\vfill, aftersection=\vfill, page=yes]
if I remove the comma after page=yes, slides are not split into different pages. Is it normal that a comma is required at the end of an argument list?
The missing comma is not the issue, it's the space. Works: \setuphead[slide] [page=yes, ] \setuphead[slide] [page=yes%% ] \setuphead[slide] [page=yes%% ] Marco
On 2016-02-19 11:23:18 +0000, Marco Patzer said:
On Fri, 19 Feb 2016 11:54:12 +0100 Nicola
wrote: How do I setup the slide command to do that by default? I have tried putting {before,after,beforesection,aftersection}=\vfill in various combinations in \setuphead, but I cannot obtain the desired effect.
\setuphead[slide][ style=\ssb, command=\MySlide, color=white, insidesection=\vfill, aftersection=\vfill, page=yes]
insidesection, of course! Thanks, that does it. I have noticed that in a few circumstances vertical alignment is not desired. How do I override the default settings on a per-slide basis? Something like: \startslide[title={...},insidesection=,aftersection=] (which does not work).
if I remove the comma after page=yes, slides are not split into different pages. Is it normal that a comma is required at the end of an argument list?
The missing comma is not the issue, it's the space.
Ah, right. For other commands space is not a problem. Go figure. Nicola
On Fri, 19 Feb 2016 12:51:14 +0100
Nicola
On 2016-02-19 11:23:18 +0000, Marco Patzer said:
On Fri, 19 Feb 2016 11:54:12 +0100 Nicola
wrote: How do I setup the slide command to do that by default? I have tried putting {before,after,beforesection,aftersection}=\vfill in various combinations in \setuphead, but I cannot obtain the desired effect.
\setuphead[slide][ style=\ssb, command=\MySlide, color=white, insidesection=\vfill, aftersection=\vfill, page=yes]
insidesection, of course! Thanks, that does it.
I have noticed that in a few circumstances vertical alignment is not desired. How do I override the default settings on a per-slide basis? Something like:
\startslide[title={...},insidesection=,aftersection=]
(which does not work).
No clue why that doesn't work. Wait for others to chime in. Here's a workaround, though: \unprotect \setuphead [slide] [insidesection=\doifnot{\structureuservariable\c!align}\c!top\vfill, aftersection=\doifnot{\structureuservariable\c!align}\c!top\vfill] \protect Then you can use: \startslide [title={Slide Two}] [align=top] text \stopslide But probably there's a better way. Marco
On 2/19/2016 1:36 PM, Marco Patzer wrote:
On Fri, 19 Feb 2016 12:51:14 +0100 Nicola
wrote: On 2016-02-19 11:23:18 +0000, Marco Patzer said:
On Fri, 19 Feb 2016 11:54:12 +0100 Nicola
wrote: How do I setup the slide command to do that by default? I have tried putting {before,after,beforesection,aftersection}=\vfill in various combinations in \setuphead, but I cannot obtain the desired effect.
\setuphead[slide][ style=\ssb, command=\MySlide, color=white, insidesection=\vfill, aftersection=\vfill, page=yes]
insidesection, of course! Thanks, that does it.
I have noticed that in a few circumstances vertical alignment is not desired. How do I override the default settings on a per-slide basis? Something like:
\startslide[title={...},insidesection=,aftersection=]
(which does not work).
No clue why that doesn't work. Wait for others to chime in.
Here's a workaround, though:
\unprotect \setuphead [slide] [insidesection=\doifnot{\structureuservariable\c!align}\c!top\vfill, aftersection=\doifnot{\structureuservariable\c!align}\c!top\vfill] \protect
no need for unprotect is you use \doifnot{\structureuservariable{align}}{top}\vfill
Then you can use:
\startslide [title={Slide Two}] [align=top] text \stopslide
But probably there's a better way.
Marco ___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 2016-02-19 14:17:02 +0000, Hans Hagen said:
On 2/19/2016 1:36 PM, Marco Patzer wrote:
On Fri, 19 Feb 2016 12:51:14 +0100 Nicola
wrote: On 2016-02-19 11:23:18 +0000, Marco Patzer said:
On Fri, 19 Feb 2016 11:54:12 +0100 Nicola
wrote: How do I setup the slide command to do that by default? I have tried putting {before,after,beforesection,aftersection}=\vfill in various combinations in \setuphead, but I cannot obtain the desired effect.
\setuphead[slide][ style=\ssb, command=\MySlide, color=white, insidesection=\vfill, aftersection=\vfill, page=yes]
insidesection, of course! Thanks, that does it.
I have noticed that in a few circumstances vertical alignment is not desired. How do I override the default settings on a per-slide basis? Something like:
\startslide[title={...},insidesection=,aftersection=]
(which does not work).
No clue why that doesn't work. Wait for others to chime in.
Here's a workaround, though:
\unprotect \setuphead [slide] [insidesection=\doifnot{\structureuservariable\c!align}\c!top\vfill, aftersection=\doifnot{\structureuservariable\c!align}\c!top\vfill] \protect
no need for unprotect is you use
\doifnot{\structureuservariable{align}}{top}\vfill
Marco, Hans, thanks! It works like a charm. Nicola
Am 2016-02-19 12:23, schrieb Marco Patzer:
On Fri, 19 Feb 2016 11:54:12 +0100 Nicola
wrote: How do I setup the slide command to do that by default? I have tried putting {before,after,beforesection,aftersection}=\vfill in various combinations in \setuphead, but I cannot obtain the desired effect.
\setuphead[slide][ style=\ssb, command=\MySlide, color=white, insidesection=\vfill, aftersection=\vfill, page=yes]
I'm in a similar situation currently, but can't quite get it to work with the mentioned solution. The attached example shows several problems. Test 1 and Test 3 show, that the \vfill at the beginning apparently adds a forced space (which is worse in Test 3 than in Test 1). Another problem is, that when the page needs to break (which is fine), the last page will not be centered. This is a logic consequence of the \vfill being after the section. Is there any other mechanism to center text on _all_ pages, no matter how often the sections or paragraphs need to get broken? Best regards Andreas
participants (4)
-
Andreas Schneider
-
Hans Hagen
-
Marco Patzer
-
Nicola