Creating a clean presentation style in 40 commits (redux)

Posted on May 14, 2020

A while back, a had created a git based tutorial for learning how to create a presentation style in ConTeXt. I chose a git based style so that it was easy to see what changed in each commit and what effect did the change have on the output. But it is cumbersome to work with, especially if you are new to ConTeXt as well as git.

So, I thought that it will be a good idea to automatically generate a single page from that git repo. This way, a new user can actually see the output without struggling with navigating git. I will try to update this post whenever I make any changes in the tutorial.

I am not completely happy with how all the information is displayed on this page, but have run out my HTML coding skills. Any suggestions to improve the output are welcome. And I hope the embedded PDFs work on all modern browsers.

Step 1: Skeleton files for creating slides

We start with two files:

The first step is to test that everything works. So, we start with skeleton code in both files. Compile the example.tex using:

context example

This will create the following files

For now, ignore the .tuc and .log file.

Note: For this example, I use an environment file rather than a module. In general, modules are setups that are shared across multiple projects while environments are setups for a specific project. Since the purpose of this tutorial is to illustrate how to create your own presentation style, I prefer an environment file over a module.

slides.tex:

\startenvironment *


\stopenvironment

example.tex:

\environment slides

\starttext

A basic example with some filler text

\input knuth

\stoptext

Step 2: Change papersize to S4

By default, ConTeXt uses A4 paper size, which does not look good in presentations. So, we change the paper size to S4: a predefined ConTeXt papersize that is 400pt x 300pt.

Run: context example and note that the paper size has changed.

See:

for details on \setuppapersize.

diff --git a/slides.tex b/slides.tex
index 72f97e3..db0a372 100644
--- a/slides.tex
+++ b/slides.tex
@@ -1,4 +1,5 @@
 \startenvironment *
 
+\setuppapersize [S4]
 
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 3: Visualize layout

By default, ConTeXt uses large margins, which make sense for paper documents but not for presentations. I will change the margin in multiple steps. The first step is just to visualize the margins.

Run: context example and notice the green rectangles that show the text area and the margins. Read

for more details on the layout, and

for details on the \showframe command.

diff --git a/example.tex b/example.tex
index 8511590..2909873 100644
--- a/example.tex
+++ b/example.tex
@@ -1,5 +1,7 @@
 \environment slides
 
+\showframe
+
 \starttext
 
 A basic example with some filler text

Full files: [slides.tex] [example.tex]

Step 4: Set horizontal margins

Set the horizontal margins to be 3mm.

Read:

for more details on the layout.

diff --git a/slides.tex b/slides.tex
index db0a372..ba6f590 100644
--- a/slides.tex
+++ b/slides.tex
@@ -2,4 +2,15 @@
 
 \setuppapersize [S4]
 
+\setuplayout
+    [
+      cutspace=3mm,
+      leftmargin=2mm,
+      leftmargindistance=1mm,
+      width=middle,
+      rightmargindistance=1mm
+      rightmargin=2mm,
+      backspace=3mm,
+    ]
+
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 5: Set vertical margin

Set the top margin to be 2mm and the bottom margin to be 1mm.

Disable headers, but keep some small space for footers (to show page number etc. in a smaller font size).

diff --git a/slides.tex b/slides.tex
index ba6f590..53e4755 100644
--- a/slides.tex
+++ b/slides.tex
@@ -8,9 +8,17 @@
       leftmargin=2mm,
       leftmargindistance=1mm,
       width=middle,
-      rightmargindistance=1mm
+      rightmargindistance=1mm,
       rightmargin=2mm,
       backspace=3mm,
+      %
+      topspace=2mm,
+      header=0mm,
+      headerdistance=0mm,
+      height=middle,
+      footerdistance=0.2\lineheight,
+      footer=0.8\lineheight,
+      bottomspace=1mm,
     ]
 
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 6: Remove layout visualization

Now that the margins are set, remove layout visualization.

diff --git a/example.tex b/example.tex
index 2909873..8511590 100644
--- a/example.tex
+++ b/example.tex
@@ -1,7 +1,5 @@
 \environment slides
 
-\showframe
-
 \starttext
 
 A basic example with some filler text

Full files: [slides.tex] [example.tex]

Step 7: Use preferred font setup

Latin Modern, the default ConTeXt font, does not look good in presentations. ConTeXt makes it easy to change the font setup. I use:

Dejavu Sana Mono is much taller than Fontin, so I scale it down to 85% so that the two fonts have similar height.

diff --git a/example.tex b/example.tex
index 8511590..3b4ca21 100644
--- a/example.tex
+++ b/example.tex
@@ -2,7 +2,7 @@
 
 \starttext
 
-A basic example with some filler text
+A basic example with some filler \mono{text}
 
 \input knuth
 
diff --git a/slides.tex b/slides.tex
index 53e4755..c82f33e 100644
--- a/slides.tex
+++ b/slides.tex
@@ -1,5 +1,12 @@
 \startenvironment *
 
+\definefontfamily [mainface] [rm] [Fontin]
+\definefontfamily [mainface] [ss] [Delicious]
+\definefontfamily [mainface] [tt] [Dejavu Sans Mono] [scale=0.85]
+\definefontfamily [mainface] [mm] [Neo Euler]
+
+\setupbodyfont[mainface, 12pt]
+
 \setuppapersize [S4]
 
 \setuplayout

Full files: [slides.tex] [example.tex]

Step 8: Enable composed characters

Fontin does not have all accented characters (e.g, ü or ç). When compose=yes is added to default font features, ConTeXt uses fallback composed characters for these missing characters.

A discussion on composed characters is out of the scope of this example. Just think of this as a workaround for an incomplete font.

diff --git a/slides.tex b/slides.tex
index c82f33e..7a32fcf 100644
--- a/slides.tex
+++ b/slides.tex
@@ -1,5 +1,10 @@
 \startenvironment *
 
+\definefontfeature
+  [default]
+  [default]
+  [compose=yes]
+
 \definefontfamily [mainface] [rm] [Fontin]
 \definefontfamily [mainface] [ss] [Delicious]
 \definefontfamily [mainface] [tt] [Dejavu Sans Mono] [scale=0.85]

Full files: [slides.tex] [example.tex]

Step 9: Disable font features in monotype fonts

This is also a workaround for a wrong default in ConTeXt. By default, TeX ligatures are enabled for monotype fonts. I think that this does more harm than good (e.g., \type{--enable} will typeset as “–enable”). So, I disable all font features for monotype fonts.

diff --git a/example.tex b/example.tex
index 3b4ca21..da1c414 100644
--- a/example.tex
+++ b/example.tex
@@ -4,6 +4,8 @@
 
 A basic example with some filler \mono{text}
 
+\type{--enable}
+
 \input knuth
 
 \stoptext
diff --git a/slides.tex b/slides.tex
index 7a32fcf..e976713 100644
--- a/slides.tex
+++ b/slides.tex
@@ -7,7 +7,7 @@
 
 \definefontfamily [mainface] [rm] [Fontin]
 \definefontfamily [mainface] [ss] [Delicious]
-\definefontfamily [mainface] [tt] [Dejavu Sans Mono] [scale=0.85]
+\definefontfamily [mainface] [tt] [Dejavu Sans Mono] [scale=0.85, features=none]
 \definefontfamily [mainface] [mm] [Neo Euler]
 
 \setupbodyfont[mainface, 12pt]

Full files: [slides.tex] [example.tex]

Step 10: Enable hanging punctuation

I think that hanging punctuation is useful for presentation. See

for details.

diff --git a/slides.tex b/slides.tex
index e976713..10829fd 100644
--- a/slides.tex
+++ b/slides.tex
@@ -3,7 +3,7 @@
 \definefontfeature
   [default]
   [default]
-  [compose=yes]
+  [compose=yes, expansion=quality, protrusion=quality]
 
 \definefontfamily [mainface] [rm] [Fontin]
 \definefontfamily [mainface] [ss] [Delicious]
@@ -12,6 +12,8 @@
 
 \setupbodyfont[mainface, 12pt]
 
+\setupalign[hanging]
+
 \setuppapersize [S4]
 
 \setuplayout

Full files: [slides.tex] [example.tex]

Step 11: Increase inter-paragraph spacing

This is again a personal preference. I think that a large inter-paragraph spacing looks good in presentations.

diff --git a/slides.tex b/slides.tex
index 10829fd..b3147e0 100644
--- a/slides.tex
+++ b/slides.tex
@@ -13,6 +13,7 @@
 \setupbodyfont[mainface, 12pt]
 
 \setupalign[hanging]
+\setupwhitespace[big]
 
 \setuppapersize [S4]
 

Full files: [slides.tex] [example.tex]

Step 12: Add slide structure

The basic structural element of a presentation is a slide. Amongst the various ways to create a slide environment, I define slides as a section heading and make it borrow all the default elements from subject heading.

diff --git a/example.tex b/example.tex
index da1c414..fd92e4e 100644
--- a/example.tex
+++ b/example.tex
@@ -2,10 +2,10 @@
 
 \starttext
 
-A basic example with some filler \mono{text}
+\startslide[title={Sample Slide}]
 
-\type{--enable}
+  \input knuth
 
-\input knuth
+\stopslide
 
 \stoptext
diff --git a/slides.tex b/slides.tex
index b3147e0..223d04c 100644
--- a/slides.tex
+++ b/slides.tex
@@ -36,4 +36,7 @@
       bottomspace=1mm,
     ]
 
+
+\definehead[slide][subject]  
+
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 13: Tweak slide style

Set the slide style according to your preference. I use the following setup:

Read:

for details on how to configure section heads.

diff --git a/slides.tex b/slides.tex
index 223d04c..2342448 100644
--- a/slides.tex
+++ b/slides.tex
@@ -37,6 +37,14 @@
     ]
 
 
-\definehead[slide][subject]  
+\definehead
+    [slide]
+    [subject]  
+    [
+      style=\ssbfc,
+      color=darkred,
+      alternative=middle,
+      hidenumber=yes,
+    ]
 
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 14: Start a new page for each slide

Adding page=yes ensures that each slide starts a new page. If a slide contains more material, it will overflow one page (and no title will appear on the next page). So, it is the responsibility of the user to ensure that a slide has the right amount of text.

diff --git a/example.tex b/example.tex
index fd92e4e..725b860 100644
--- a/example.tex
+++ b/example.tex
@@ -2,6 +2,12 @@
 
 \starttext
 
+\startslide[title={First Slide}]
+
+  This is a short slide
+
+\stopslide
+
 \startslide[title={Sample Slide}]
 
   \input knuth
diff --git a/slides.tex b/slides.tex
index 2342448..1f16d72 100644
--- a/slides.tex
+++ b/slides.tex
@@ -45,6 +45,7 @@
       color=darkred,
       alternative=middle,
       hidenumber=yes,
+      page=yes,
     ]
 
 \stopenvironment

Full files: [slides.tex] [example.tex]

I use a simple pagenumber in footers. See

for details.

diff --git a/slides.tex b/slides.tex
index 1f16d72..36b5f60 100644
--- a/slides.tex
+++ b/slides.tex
@@ -37,6 +37,9 @@
     ]
 
 
+\setupfooter[style=small,color=darkblue]
+\setupfootertexts[][\userpagenumber/\lastuserpage]
+
 \definehead
     [slide]
     [subject]  

Full files: [slides.tex] [example.tex]

Step 16: Change background color

I remember reading somewhere that white is not a good color for slides. So, I change the background color to lightgray. See

for more details.

diff --git a/slides.tex b/slides.tex
index 36b5f60..2bcb31b 100644
--- a/slides.tex
+++ b/slides.tex
@@ -37,6 +37,8 @@
     ]
 
 
+\setupbackgrounds[page][background=color, backgroundcolor=lightgray]
+
 \setupfooter[style=small,color=darkblue]
 \setupfootertexts[][\userpagenumber/\lastuserpage]
 

Full files: [slides.tex] [example.tex]

Step 17: An example for itemized list

By default, ConTeXt uses $\bullet$ as the marker for top level itemization. I don’t particularly like this marker, and in the next few steps, I will show how to change them item marker.

diff --git a/example.tex b/example.tex
index 725b860..528a34d 100644
--- a/example.tex
+++ b/example.tex
@@ -4,7 +4,16 @@
 
 \startslide[title={First Slide}]
 
-  This is a short slide
+\startitemize
+    \starthead {First bullet}
+      Avoid using too many bullets. It is better to use paragraphs.
+    \stophead
+
+    \starthead {Second bullet}
+      Nonetheless sometimes you are stuck at using bullets. In such cases, make
+      sure that the bullets look nice.
+    \stophead
+\stopitemize
 
 \stopslide
 

Full files: [slides.tex] [example.tex]

Step 18: Setup itemize head style

The itemize environment in ConTeXt provides two types of items: normal items that are created using \item or \startitem ... \stopitem and items with heads, created using \head or \starthead ... \stophead.

I like to use the second alternative in presentations. The advantage is that the item head can be typeset in a different style than the regular items; so it adds some emphasis to the main points.

See:

for more details.

diff --git a/slides.tex b/slides.tex
index 2bcb31b..7460279 100644
--- a/slides.tex
+++ b/slides.tex
@@ -53,4 +53,13 @@
       page=yes,
     ]
 
+
+\setupitemize
+    [
+      headstyle=\ssa,
+      headcolor=darkred,
+    ]
+
+
+
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 19: Use metapost to create a item marker

I like to use filled square as the top-level item marker. Rather than using math symbols for the item marker, I use Metapost to draw the square.

For more details on using MetaPost, read:

For details on symbols, read:

Full files: [slides.tex] [example.tex]

Step 20: Set spacing for itemize

Tweak the spacing around bullet according to your preference.

diff --git a/slides.tex b/slides.tex
index 98db75f..b2cf8a9 100644
--- a/slides.tex
+++ b/slides.tex
@@ -58,6 +58,8 @@
     [
       headstyle=\ssa,
       headcolor=darkred,
+      afterhead={\blank[none]},
+      inbetween={\blank[2*big]},
     ]
 
 \startuseMPgraphic{itemize:main}

Full files: [slides.tex] [example.tex]

Step 21: Example for nested bullet list

Sometimes I use nested levels of itemization in presentations. The default settings for 2nd level of itemization does not look nice. I will change these defaults in the next few edits.

diff --git a/example.tex b/example.tex
index 528a34d..10605a0 100644
--- a/example.tex
+++ b/example.tex
@@ -7,6 +7,10 @@
 \startitemize
     \starthead {First bullet}
       Avoid using too many bullets. It is better to use paragraphs.
+      \startitemize
+        \item Especially nested bullet lists
+        \item That make it hard to understand the main point
+      \stopitemize
     \stophead
 
     \starthead {Second bullet}

Full files: [slides.tex] [example.tex]

Step 22: Tight itemized list for level 2

By default, lists in ConTeXt are unpacked. I prefer to use second level lists without any additional spacing around the items; hence the nowhite option.

This setup is not perfect because of the extra space before the 2nd level items. This will be fixed in the next commit

diff --git a/slides.tex b/slides.tex
index b2cf8a9..c3dbc7d 100644
--- a/slides.tex
+++ b/slides.tex
@@ -71,6 +71,7 @@
 \definesymbol[itemize:main][\useMPgraphic{itemize:main}]
 
 \setupitemize[1][symbol=itemize:main]
+\setupitemize[2][nowhite]
 
 
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 23: Remove unwanted spacing before 2nd level list

ConTeXt provides different alternatives for determining the spacing around itemized lists, but there is no high level interface around these alternatives.

With the default alternative, I could not set the spacing around itemized lists according to my liking; so I change an internal macro to choose a different alternative for determining spacing around itemize lists.

There might be a better, higher-level way to get the same visual output, but I am not aware of it.

diff --git a/slides.tex b/slides.tex
index c3dbc7d..21bf9a9 100644
--- a/slides.tex
+++ b/slides.tex
@@ -73,5 +73,8 @@
 \setupitemize[1][symbol=itemize:main]
 \setupitemize[2][nowhite]
 
+\unprotect
+\c_strc_itemgroups_spacing_mode\plusone
+\protect
 
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 24: Set 2nd level itemize marker

I like to use a small triangle as a marker for 2nd level itemized lists. Rather than using a math symbol for the triangle, I use Metapost as before.

diff --git a/slides.tex b/slides.tex
index 21bf9a9..ff1ea60 100644
--- a/slides.tex
+++ b/slides.tex
@@ -68,9 +68,17 @@
   fill p withcolor \MPcolor{darkred};
 \stopuseMPgraphic
 
+\startuseMPgraphic{itemize:nested}
+  save p; path p;
+  p := ( (0,-0.5)--(0,0.5)--(0.866,0)--cycle ) scaled ExHeight;
+  fill p withcolor \MPcolor{darkred};
+\stopuseMPgraphic
+
 \definesymbol[itemize:main][\useMPgraphic{itemize:main}]
+\definesymbol[itemize:nested][\useMPgraphic{itemize:nested}]
 
 \setupitemize[1][symbol=itemize:main]
+\setupitemize[2][symbol=itemize:nested, width=1.5ex]
 \setupitemize[2][nowhite]
 
 \unprotect

Full files: [slides.tex] [example.tex]

Step 25: Set document metadata

Simply set the metadata. The next few commits will show how to use this metadata.

diff --git a/example.tex b/example.tex
index 10605a0..d41cab7 100644
--- a/example.tex
+++ b/example.tex
@@ -2,6 +2,15 @@
 
 \starttext
 
+\setvariables
+    [metadata]
+    [
+      title={Creating slides in ConTeXt},
+      author={ConTeXt user},
+      date={Jan 13, 2013},
+      location={ConTeXt Interactive Tutorial},
+    ]
+
 \startslide[title={First Slide}]
 
 \startitemize

Full files: [slides.tex] [example.tex]

Again, this is a matter of personal choice. I like to include the presentation title and the author in the footer of each slide. Read:

for details on setting the footer and

for information on variables.

diff --git a/slides.tex b/slides.tex
index ff1ea60..d1b764f 100644
--- a/slides.tex
+++ b/slides.tex
@@ -40,7 +40,11 @@
 \setupbackgrounds[page][background=color, backgroundcolor=lightgray]
 
 \setupfooter[style=small,color=darkblue]
-\setupfootertexts[][\userpagenumber/\lastuserpage]
+\setupfootertexts[\setups{footer:metadata}][\userpagenumber/\lastuserpage]
+
+\startsetups footer:metadata
+  \getvariable{metadata}{title} (\getvariable{metadata}{author})
+\stopsetups
 
 \definehead
     [slide]

Full files: [slides.tex] [example.tex]

Step 27: Simple title page

This shows how to create a titlepage. The main idea is to use the set key for variables to call a setup that uses a makeup page to create the titlepage. Notice that the page numbers of the subsequent pages are correct. This is because we used \userpage and \lastuserpage to show page numbers, and a makeup page does not increment the userpage number.

The title page is has no style setup. The next few commits will show how to add different style elements to the titlepage.

diff --git a/slides.tex b/slides.tex
index d1b764f..6b45a25 100644
--- a/slides.tex
+++ b/slides.tex
@@ -89,4 +89,24 @@
 \c_strc_itemgroups_spacing_mode\plusone
 \protect
 
+\setvariables
+    [metadata]
+    [
+      set={\setups{titlepage}},
+    ]
+
+\startsetups titlepage
+  \startstandardmakeup[align=middle]
+    \getvariable{metadata}{title}
+    \blank[2*big]
+
+    \getvariable{metadata}{author}
+    \blank[big]
+
+    \getvariable{metadata}{location}
+    \blank[none]
+    \getvariable{metadata}{date}
+  \stopstandardmakeup
+\stopsetups
+
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 28: Added styling to titlepage

There are different ways to add style to the titlepage. I create different style commands: titlestyle, authorstyle, etc for each metadata element and then use them to style the corresponding element.

diff --git a/slides.tex b/slides.tex
index 6b45a25..cdf1e4b 100644
--- a/slides.tex
+++ b/slides.tex
@@ -95,17 +95,22 @@
       set={\setups{titlepage}},
     ]
 
+\definestyle[titlestyle]   [style=\ssbfd, color=darkred]
+\definestyle[authorstyle]  [style=\ssb,   color=darkblue]
+\definestyle[datestyle]    [style=\tf,    color=]
+\definestyle[locationstyle][style=\tf,    color=]
+
 \startsetups titlepage
   \startstandardmakeup[align=middle]
-    \getvariable{metadata}{title}
+    \titlestyle{\getvariable{metadata}{title}}
     \blank[2*big]
 
-    \getvariable{metadata}{author}
+    \authorstyle{\getvariable{metadata}{author}}
     \blank[big]
 
-    \getvariable{metadata}{location}
+    \locationstyle{\getvariable{metadata}{location}}
     \blank[none]
-    \getvariable{metadata}{date}
+    \datestyle{\getvariable{metadata}{date}}
   \stopstandardmakeup
 \stopsetups
 

Full files: [slides.tex] [example.tex]

Step 29: Sample text for display math

Notice that by default, ConTeXt uses \blank[big] around displaymath. In the next commit, In the next commit, I will correct the spacing.

diff --git a/example.tex b/example.tex
index d41cab7..52e5125 100644
--- a/example.tex
+++ b/example.tex
@@ -36,4 +36,14 @@
 
 \stopslide
 
+\startslide[title={Some math}]
+
+  Here is an example with display math with a long line preceeding it
+  \startformula
+    f(x) =  a_i x^i
+  \stopformula
+  and a long line following the display math. 
+
+\stopslide
+
 \stoptext

Full files: [slides.tex] [example.tex]

Step 30: Set spacing around display math

Setting spacing around display math is a bit tricky. The obvious

\setupformulas[spacebefore=small, spaceafter=small]

does not work. I think that this is because I use

\setupwhitespace[big]

and ConTeXt vertical spacing model is such that the largest vspace value (big in this case) wins.

After a bit of trial and error, I settled on this:

\setupformula
    [spacebefore={nowhite,quarterline}, spaceafter={back,nowhite,quarterline}]

For spacebefore, the parameter nowhite kills all the whitespace and then quarterline sets the space before the formula to be 0.25\lineheight.

Surprisingly, the same setting {nowhite,quarterline} does not work when used for spaceafter. We need an addition back parameter to kill the previous vpsace.

diff --git a/slides.tex b/slides.tex
index cdf1e4b..60897b3 100644
--- a/slides.tex
+++ b/slides.tex
@@ -114,4 +114,7 @@
   \stopstandardmakeup
 \stopsetups
 
+\setupformula
+    [spacebefore={nowhite,quarterline}, spaceafter={back,nowhite,quarterline}]
+
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 31: Example text for images

The simpleslides module provides two ways of including images: a horizontal mode and a vertical mode. I like that, and want to provide similar alternatives in this case.

A horizontal image should occupy as must horizontal space as possible without overflowing the page height.

A vertical image should not be wider than 0.5\textwidth and should occupy as much vertical space as possible.

For now, we use dummy settings horizontal and vertical for these two types of images. The actual settings will be defined in the the next commits.

diff --git a/example.tex b/example.tex
index 52e5125..ad9efc0 100644
--- a/example.tex
+++ b/example.tex
@@ -1,5 +1,8 @@
 \environment slides
 
+% To enable the use of sample images in ConTeXt distrubtion
+\setupexternalfigures[location={local,global,default}]
+
 \starttext
 
 \setvariables
@@ -46,4 +49,33 @@
 
 \stopslide
 
+\startslide[title={Horizontal Image}]
+  \startplacefigure
+    \externalfigure[hacker][horizontal]
+  \stopplacefigure
+\stopslide
+
+\startslide[title={Horizontal Image with text}]
+  \input ward
+
+  \startplacefigure
+    \externalfigure[hacker][horizontal]
+  \stopplacefigure
+\stopslide
+
+\startslide[title={Vertical Image}]
+  \startplacefigure
+    \externalfigure[mill][vertical]
+  \stopplacefigure
+\stopslide
+
+\startslide[title={Vertical Image with text}]
+  \startplacefigure[location=left]
+    \externalfigure[hacker][vertical][width=0.5\textwidth]
+  \stopplacefigure
+  \input ward
+
+\stopslide
+
+
 \stoptext

Full files: [slides.tex] [example.tex]

Step 32: Remove figure numbers

I don’t prefer the figures in presentations to be numbered so I remove them.

diff --git a/slides.tex b/slides.tex
index 60897b3..c0f829d 100644
--- a/slides.tex
+++ b/slides.tex
@@ -117,4 +117,9 @@
 \setupformula
     [spacebefore={nowhite,quarterline}, spaceafter={back,nowhite,quarterline}]
 
+\setupcaptions
+    [
+      number=no,
+    ]
+
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 33: Define settings for horizontal images

Read:

for details on defining settings for figures.

To determine the amount of vertical space left on the page, we define a measure page. The exact value of this measure is taken from a solution by Wolfgang Schuster on the ConTeXt mailing list.

diff --git a/slides.tex b/slides.tex
index c0f829d..f80270f 100644
--- a/slides.tex
+++ b/slides.tex
@@ -122,4 +122,14 @@
       number=no,
     ]
 
+\definemeasure[page][\dimexpr\pagegoal-\pagetotal-\lineheight\relax]
+
+\defineexternalfigure
+    [horizontal]
+    [
+      width=\textwidth,
+      height=\measure{page},
+      factor=max,
+    ]
+
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 34: Add setting for vertical images

The idea for the settings for vertical images is the same as that of horizontal images. We add a little bit more vertical space around vertical images.

diff --git a/example.tex b/example.tex
index ad9efc0..2ac16d4 100644
--- a/example.tex
+++ b/example.tex
@@ -71,7 +71,7 @@
 
 \startslide[title={Vertical Image with text}]
   \startplacefigure[location=left]
-    \externalfigure[hacker][vertical][width=0.5\textwidth]
+    \externalfigure[mill][vertical]
   \stopplacefigure
   \input ward
 
diff --git a/slides.tex b/slides.tex
index f80270f..de24daa 100644
--- a/slides.tex
+++ b/slides.tex
@@ -117,12 +117,14 @@
 \setupformula
     [spacebefore={nowhite,quarterline}, spaceafter={back,nowhite,quarterline}]
 
+
 \setupcaptions
     [
       number=no,
     ]
 
 \definemeasure[page][\dimexpr\pagegoal-\pagetotal-\lineheight\relax]
+\definemeasure[shortpage][\dimexpr\pagegoal-\pagetotal-\lineheight-2\bigskipamount\relax]
 
 \defineexternalfigure
     [horizontal]
@@ -132,4 +134,11 @@
       factor=max,
     ]
 
+\defineexternalfigure
+    [vertical]
+    [
+      width=0.5\textwidth,
+      height=\measure{shortpage},
+      factor=max,
+    ]
 \stopenvironment

Full files: [slides.tex] [example.tex]

Step 35: Tweak space around figures

By default, ConTeXt includes a big space before and after a float. I find that to be excessive; so I reduced the space.

See:

for details.

diff --git a/slides.tex b/slides.tex
index de24daa..5f5ec3f 100644
--- a/slides.tex
+++ b/slides.tex
@@ -123,6 +123,12 @@
       number=no,
     ]
 
+\setupfloats
+    [
+      spacebefore=nowhite,
+      spaceafter=small,
+    ]
+
 \definemeasure[page][\dimexpr\pagegoal-\pagetotal-\lineheight\relax]
 \definemeasure[shortpage][\dimexpr\pagegoal-\pagetotal-\lineheight-2\bigskipamount\relax]
 

Full files: [slides.tex] [example.tex]

Step 36: Prelim to defining a fancy background

I want to add some subtle affects to the background. For that, I will use MetaPost. As a first step, I redraw the colored background using MetaPost. See the MetaFun manual for details.

diff --git a/slides.tex b/slides.tex
index 5f5ec3f..b49530b 100644
--- a/slides.tex
+++ b/slides.tex
@@ -37,7 +37,15 @@
     ]
 
 
-\setupbackgrounds[page][background=color, backgroundcolor=lightgray]
+\startreusableMPgraphic {page:background}
+  StartPage;
+    fill Page withcolor \MPcolor{lightgray};
+  StopPage;
+\stopreusableMPgraphic
+
+\defineoverlay [page:background][\reuseMPgraphic{page:background}]
+
+\setupbackgrounds[page][background={page:background}]
 
 \setupfooter[style=small,color=darkblue]
 \setupfootertexts[\setups{footer:metadata}][\userpagenumber/\lastuserpage]

Full files: [slides.tex] [example.tex]

Step 37: Create a subtle red border around each slide

I like this subtle background, but this example shows that you are free to pick any MetaPost graphic that you like as a background.

diff --git a/slides.tex b/slides.tex
index b49530b..62d83da 100644
--- a/slides.tex
+++ b/slides.tex
@@ -39,7 +39,10 @@
 
 \startreusableMPgraphic {page:background}
   StartPage;
-    fill Page withcolor \MPcolor{lightgray};
+    save p; path p;
+    p := Page superellipsed 0.98;
+    fill Page withcolor \MPcolor{darkred};
+    fill p withcolor \MPcolor{lightgray};
   StopPage;
 \stopreusableMPgraphic
 

Full files: [slides.tex] [example.tex]

Step 38: Add a visual counter for page numbers

See the documentation of t-visualcounter for details.

Full files: [slides.tex] [example.tex]

Step 39: Use named colors

The present style uses four colors. To make it easy to change the colorscheme, I define four colors: background:light, background:dark, foreground:contrast, foreground:altcontrast and use them in all the setups.

Using named colors makes it easy to change the color scheme by simply changing the values for each of the colors.

diff --git a/slides.tex b/slides.tex
index 43a533a..4a400e2 100644
--- a/slides.tex
+++ b/slides.tex
@@ -36,13 +36,18 @@
       bottomspace=1mm,
     ]
 
+\definecolor[background:light][lightgray]
+\definecolor[background:dark] [darkgray]
+
+\definecolor[foreground:contrast]    [darkred]
+\definecolor[foreground:altcontrast] [darkblue]
 
 \startreusableMPgraphic {page:background}
   StartPage;
     save p; path p;
     p := Page superellipsed 0.98;
-    fill Page withcolor \MPcolor{darkred};
-    fill p withcolor \MPcolor{lightgray};
+    fill Page withcolor \MPcolor{foreground:contrast};
+    fill p withcolor \MPcolor{background:light};
   StopPage;
 \stopreusableMPgraphic
 
@@ -63,12 +68,12 @@
 \definepalet
     [counter]
     [
-      past=darkred,
-      active=darkblue,
-      future=darkgray,
+      past=foreground:contrast,
+      active=foreground:altcontrast,
+      future=background:dark,
     ]
 
-\setupfooter[style=small,color=darkblue]
+\setupfooter[style=small,color=foreground:altcontrast]
 \setupfootertexts[\setups{footer:metadata}][\tfx\usevisualcounter{userpage}]
 
 \startsetups footer:metadata
@@ -80,7 +85,7 @@
     [subject]  
     [
       style=\ssbfc,
-      color=darkred,
+      color=foreground:contrast,
       alternative=middle,
       hidenumber=yes,
       page=yes,
@@ -90,7 +95,7 @@
 \setupitemize
     [
       headstyle=\ssa,
-      headcolor=darkred,
+      headcolor=foreground:contrast,
       afterhead={\blank[none]},
       inbetween={\blank[2*big]},
     ]
@@ -98,13 +103,13 @@
 \startuseMPgraphic{itemize:main}
   save p; path p;
   p := fullsquare scaled 1.5ExHeight;
-  fill p withcolor \MPcolor{darkred};
+  fill p withcolor \MPcolor{foreground:contrast};
 \stopuseMPgraphic
 
 \startuseMPgraphic{itemize:nested}
   save p; path p;
   p := ( (0,-0.5)--(0,0.5)--(0.866,0)--cycle ) scaled ExHeight;
-  fill p withcolor \MPcolor{darkred};
+  fill p withcolor \MPcolor{foreground:contrast};
 \stopuseMPgraphic
 
 \definesymbol[itemize:main][\useMPgraphic{itemize:main}]
@@ -124,8 +129,8 @@
       set={\setups{titlepage}},
     ]
 
-\definestyle[titlestyle]   [style=\ssbfd, color=darkred]
-\definestyle[authorstyle]  [style=\ssb,   color=darkblue]
+\definestyle[titlestyle]   [style=\ssbfd, color=foreground:contrast]
+\definestyle[authorstyle]  [style=\ssb,   color=foreground:altcontrast]
 \definestyle[datestyle]    [style=\tf,    color=]
 \definestyle[locationstyle][style=\tf,    color=]
 

Full files: [slides.tex] [example.tex]

Step 40: Create tagged pdf

Tagged PDFs is a PDF file that contains meta-information around elements in the PDF. For example, it will indicate what is a section heading, what is footnote, etc. This meta-information is useful for accessibility (e.g., for screen readers to properly read the PDF file).

diff --git a/slides.tex b/slides.tex
index 4a400e2..d65622b 100644
--- a/slides.tex
+++ b/slides.tex
@@ -123,6 +123,8 @@
 \c_strc_itemgroups_spacing_mode\plusone
 \protect
 
+\setuptagging[state=start]
+
 \setvariables
     [metadata]
     [

Full files: [slides.tex] [example.tex]


This entry was posted in Design and tagged git, presentation, tutorial.