ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Willi Egger via ntg-context <ntg-context@ntg.nl>
Cc: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>,
	Willi Egger <context@boede.nl>
Subject: Re: Metafun, difficulty with graphical element in the margin
Date: Sun, 20 Mar 2022 17:21:33 +0100	[thread overview]
Message-ID: <601a4851-fe50-ef5e-9a99-29941e25c22f@gmail.com> (raw)
In-Reply-To: <E31F097A-D03E-4E71-AA42-E6357156E1A2@boede.nl>

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

Willi Egger via ntg-context schrieb am 20.03.2022 um 17:05:
> Hoi Wolfgang,
>
> I tested both variants (bodymatter and bodypart. The compilation runs through, however without the thumb-picture in the margin and the metafun error is in the log.

1. Do you use \startfrontmatter and \startbodymatter in your document to 
create blocks?

2. Is you installation up-to-date?

Attached is a slightly modified version of your example, the only thing 
which has to be local to the bodypart is the background setting to 
enable the thumb pictures.

Wolfgang


[-- Attachment #2: test.tex --]
[-- Type: text/plain, Size: 9048 bytes --]

\definecolor [chap_frame] [black]
\definecolor [textcolor]  [white]

\startuseMPgraphic{chapter-thumb}
    path chap_frame ;
    pair pos,a,b ;
    picture Chap ;

    if \somenamedheadnumber{chapter}{current} > 0 :
        curr_chap := \somenamedheadnumber{chapter}{current} ;
    else :
        curr_chap := 1 ;
    fi;
    if \somenamedheadnumber{chapter}{last} > 0 :
        last_chap := \somenamedheadnumber{chapter}{last} ;
    else :
        last_chap := 1 ;
    fi;
    if \somenamedheadnumber{section}{current} > 0 :
        curr_sect := \somenamedheadnumber{section}{current} ;
    else:
        curr_sect := 1 ;
    fi;
    if \somenamedheadnumber{section}{last} > 0 :
        last_sect := \somenamedheadnumber{section}{last} ;
    else:
        last_sect := 1;
    fi;
    if curr_chap < 11 :
        skip := TextHeight * (curr_chap-1)/11 ;
    elseif curr_chap < 21 :
        skip := TextHeight * (curr_chap-11)/11 ;
    else:
        skip := TextHeight * (curr_chap-21)/11 ;
    fi;

    Chap := textext("\bfa\textcolor\getmarking[chapter]") ;

    StartPage ;
        chap_frame := lcircle xscaled (2*RightMarginWidth) yscaled (1.5*RightMarginWidth) ;

        a := ulcorner chap_frame ;
        b := urcorner chap_frame ;

        pos := urcorner Field[Text][RightMarginSeparator] - ulcorner chap_frame - (-1mm,skip) ;

        fill chap_frame shifted pos withcolor "chap_frame" ;
        draw Chap rotated 90 shifted (xpart pos-4mm,ypart pos) ;
    StopPage ;
\stopuseMPgraphic

\defineoverlay[chapter-thumb][\useMPgraphic{chapter-thumb}]

\startsectionblockenvironment[bodypart]
    \setupbackgrounds[rightpage][background=chapter-thumb]
\stopsectionblockenvironment

\showframe

\starttext

\startfrontmatter

\startchapter[title=Test A]
	\samplefile{ward}
\stopchapter

\stopfrontmatter

\startbodymatter

\startchapter[title=Test C]
	\samplefile{ward}
\stopchapter

\stopbodymatter

\stoptext























% Global settings for all chapters
\setuphead[chapter][style=\ssc]

% Local settings for chapter in the bodymatter block
\startsectionblockenvironment[bodypart]
\setuphead[chapter][color=blue]
\stopsectionblockenvironment

\starttext

\startfrontmatter

\title{Table of content}

\placecontent

\stopfrontmatter

\startbodymatter

\chapter{Knuth}

\input knuth

\chapter{Zapf}

\input zapf

\stopbodymatter

\stoptext





\starttext

a\texttilde b\lettertilde c\textasciitilde d

\stoptext




\definepageinjectionalternative
  [chapter:image]
  [renderingsetup=pageinjection:chapter:image]

\startsetups [pageinjection:chapter:image]
  \centerbox{\externalfigure[\dummyparameter{name}]}
\stopsetups

\definepageinjection
  [chapter:start]
  [empty]
  [page=left]

\definepageinjection
  [chapter:insert]
  [previouspage]
  [alternative=chapter:image,
   offset=1cm,
   pagestate=stop]

\setuphead
  [chapter]
  [beforesection={\pageinjection[chapter:start]},
   insidesection={\pageinjection[chapter:insert][name={chapter-\namedheadnumber{chapter}}]}]

\setuppagenumbering
  [alternative=doublesided]

\setupexternalfigures
  [location=default]

\useexternalfigure [chapter-1] [mill]   [factor=max]
\useexternalfigure [chapter-2] [hacker] [orientation=90,scale=2000]
\useexternalfigure [chapter-3] [cow]    [orientation=90,height=\framedwidth]

\starttext

\startchapter [title={Mill}]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\startchapter [title={Hacker}]
\dorecurse{11}{\samplefile{lorem}}
\stopchapter

\startchapter [title={cow}]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\stoptext




\setupbodyfont[termes]

\starttext

plays \m{\frac{2}{3} A}, \m{\frac{1}{3} D}.

\stoptext






\definefallbackfamily[story][serif][notoserif][range={greekandcoptic,greekextended},force=yes]
\definefontfamily[story][serif][TeX Gyre Schola]

\definefontfamily [story] [sans] [Latin Modern Sans]
\definefontfamily [story] [mono] [Latin Modern Mono] [features=none]

\definetypeface [story] [ss] [sans] [modern] [default]
\definetypeface [story] [ss] [mono] [modern] [default]

\definetypeface [story] [ss] [sans] [modern-designsize] [default]
\definetypeface [story] [ss] [mono] [modern-designsize] [default]

\definefontfamily[story][mm][TeX Gyre Pagella Math]

\definetypeface [story] [mm] [math] [pagella] [default]

\setupbodyfont[story,11pt]

\usebodyfont[termes]

\showframe

\startsetups [blockquote:style]
    \switchtobodyfont[termes]
    \setupwhitespace[2pt]
\stopsetups

\setupdelimitedtext
  [blockquote]
  [spacebefore=big,
         style=\directsetup{blockquote:style},
     indenting=none,
    indentnext=yes]

\starttext
\chapter{Testing}
\input ward

\startblockquote
\input knuth

\stopblockquote

\input zapf

{\it This is what Italic letters look like.} {\bf And these are bold.}


\startblockquote
This is what it said, in {\it Italic} and {\bf bold} letters:

\bgroup
\it This is what Italic letters look like here.
\egroup

\bgroup
\bf This is what Bold letters look like here.
\egroup
\stopblockquote

\stoptext











\definelayer [testlayer]

\setupbackgrounds [text] [text] [background=testlayer]

%\setupbackgrounds[state=repeat]

\starttext

\setlayer [testlayer] [x=1cm,y=1cm] {Text background}

\dorecurse{4}{xxx\page}

\stoptext






\starttext

text {\italicface text {\boldface text} text} text

text {\it text {\bf text} text} text: here the third instance of text is in boldface, but not in italic boldface.

text {\it text {\bi text} text} text

\stoptext


\unprotect

\def\pack_layers_positioned_box_nop
  {\vpack
     {\writestatus{WOLF}{\getboxlly\b_layers}%
      \writestatus{WOLF}{\getboxllx\b_layers}%
      \vskip-\getboxlly\b_layers
      \hskip-\getboxllx\b_layers
      \hsize-\dimexpr\getboxllx\b_layers-\wd\b_layers\relax
      \ifconditional\c_pack_layers_repeated\copy\else\box\fi\b_layers}}

\protect

\setuppapersize[A4][A3]

\setuplayout[location=middle]

\definelayer
  [test]
  [%option=test,
   %method=fit,
   position=yes]

\setupbackgrounds [text] [text] [background=test]

\setupbackgrounds[state=repeat]

\starttext

text \setlayer[test]{layer} text

\page

text

\stoptext






\starttext

\startitemize[columns,three]
\startitem One \stopitem
\startitem Two\par Three \stopitem
\stopitemize


\stoptext










\starttext

text {\italicface text {\boldface text} text} text

\stoptext




\unprotect

\def\page_backgrounds_set_boxes
  {\ifconditional\c_page_backgrounds_new
     \page_backgrounds_set_boxes_r
   \fi
   \doifbothsides
     \page_backgrounds_set_boxes_a
     \page_backgrounds_set_boxes_b
     \page_backgrounds_set_boxes_c
   \ifx\p_page_backgrounds_state\v!repeat\else
     \global\setfalse\c_page_backgrounds_new
   \fi}

\protect

%\definelayer [l_page]
\definelayer [l_text]

%\setupbackgrounds [page] [background=l_page]
\setupbackgrounds [text] [text] [background=l_text]

\setupbackgrounds[state=repeat]

\starttext

%\setlayer [l_page] [x=1cm,y=1cm] {Page background}
\setlayer [l_text] [x=1cm,y=1cm] {Text background}

\tracingmacros1
\dorecurse{4}{xxx\page}
\tracingmacros0

\stoptext







\showgrid

\starttext

\samplefile{lorem}

\page

\start \setupinterlinespace[2]% 2 lines, also possible: 1.5, 3, ...
\samplefile{lorem}\par
\stop

\page

\start \setupinterlinespace[line=5.6ex]% also possible: \setupinterlinespace[5.6ex]
\samplefile{lorem}\par
\stop

\stoptext



\starttexdefinition RemovePreceding #1
    \removeunwantedspaces
    #1
\stoptexdefinition

\starttexdefinition RemoveFollowing #1
    #1
    \ignorespaces
\stoptexdefinition

\starttext

Bla \RemovePreceding{Bla} Bla

Bla \RemoveFollowing{Bla} Bla

\stoptext



\starttexdefinition Italic #1
    \emphasized{#1}
    \autoinsertnextspace
\stoptexdefinition

\starttexdefinition Underbar #1
    \underbar{#1}
\stoptexdefinition

\starttext

Bla Bla Bla

\Underbar{\Italic{Bla} , Bla Bla.}

\stoptext





\startxmlsetups xml:test
    \xmlsetsetup{#1}{*}{-}
    \xmlsetsetup{#1}{article|p|italic|underline}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

\startxmlsetups xml:article
\starttext
    \xmlflush{#1}
\stoptext
\stopxmlsetups

\startxmlsetups xml:p
    \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:italic
    \emph{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:underline
    \underbar{\xmlflush{#1}}
\stopxmlsetups

\startbuffer[test]
<?xml version="1.0" encoding="UTF-8"?>
<article>
    <p>Bla Bla Bla</p>
    <p>
        <underline>
        <italic>Bla</italic>
        </underline>, Bla Bla.</p>
</article>
\stopbuffer

\starttext
\xmlprocessbuffer{test}{test}{}
\stoptext

[-- Attachment #3: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-03-20 16:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 19:29 Willi Egger via ntg-context
2022-03-19  5:41 ` śrīrāma via ntg-context
2022-03-19  8:39 ` Hans Hagen via ntg-context
2022-03-19 15:52 ` Otared Kavian via ntg-context
2022-03-19 20:42   ` Willi Egger via ntg-context
2022-03-19 22:39     ` Otared Kavian via ntg-context
2022-03-20 15:46       ` Willi Egger via ntg-context
2022-03-20 10:28     ` Wolfgang Schuster via ntg-context
2022-03-20 15:53       ` Willi Egger via ntg-context
2022-03-20 16:00         ` Wolfgang Schuster via ntg-context
2022-03-20 16:05           ` Willi Egger via ntg-context
2022-03-20 16:21             ` Wolfgang Schuster via ntg-context [this message]
2022-03-21  9:04               ` Willi Egger via ntg-context

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=601a4851-fe50-ef5e-9a99-29941e25c22f@gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=context@boede.nl \
    --cc=wolfgang.schuster.lists@gmail.com \
    /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).