[NTG-context] Custom TOC with makeup and setups

2023-05-10 Thread Jethro Djan via ntg-context
Hello,

I am trying to create a presentation where at the start of each section in
my presentation, a custom TOC page is shown. When I am at a particular
section, the TOC will grey out all other sections (not implemented in my
MWE). I have tried different ways but I find using makeups for the TOC page
works ok (following
https://wiki.contextgarden.net/Command/setuplistalternative and Aditya's
presentation slides on their blog). My challenge is that when a makeup page
is inserted, it leaves a page with the section name blank before it. How do
I fix it? Any other way to achieve this is also welcome. My MWE:

\setuppapersize[S6]
\startuseMPgraphic{itemize:toc}
  save p; path p;
  p := ( (0,-0.5)--(0,0.5)--(0.866,0)--cycle ) scaled 1.5ExHeight;
  fill p withcolor \MPcolor{Black};
\stopuseMPgraphic

\definesymbol[itemize:toc][\useMPgraphic{itemize:toc}]

\definelistalternative
  [toclist]
  [renderingsetup=list:toclist]

\setupheadtext[section=Table of Contents]

\startsetups toclist
  \framed[align=normal, frame=off]{\placelist [section] [criterium=all,
alternative=toclist]}
\stopsetups

\definehspace[tspace][4cm]
\setupframed[
  height=fit,
  width=fit,
  location=middle,
  frame=off,
  align=normal,
  offset=none,
]
\startsetups list:toclist
  {\hbox to \hsize \bgroup
  \hspace[tspace]
  \framed[width=10mm,align=flushleft]{\symbol[itemize:toc]}%
  \framed[empty=yes]{\currentlistentrynumber\currentlistentrypagenumber}%
  \doifelse\currentlistentrylocation{\namedstructureheadlocation{section}}{%
\framed[align=flushright,]{{\bfb\currentlistentrytitle}}%
  }{\framed[align=flushright,]{\currentlistentrytitle}}
  \egroup}
\stopsetups



 \definemakeup
  [toc]
  [
doublesided=no,
page=yes,
bottom=,
top=,
pagestate=start,
headerstate=empty,
footerstate=empty,
setups={toclist},
before=\setups{toc:setups},
  ]
\startsetups toc:setups
  \setupbackgrounds[page][background=color, backgroundcolor=blue]
\stopsetups

 \definemakeup
  [standard]
  [
doublesided=no,
page=right,
pagestate=start,
headerstate=empty,
footerstate=empty,
before=\setups{standard:setups},
  ]

 \startsetups standard:setups
\setupbackgrounds[page][background=color, backgroundcolor=lightgray]
 \stopsetups

 \define\TOC{
  \starttocmakeup
  \stoptocmakeup
 }

\starttext

\startstandardmakeup
  \title{Your Title Here}
\stopstandardmakeup

\startsection[title={Motivation}]
\TOC
\startitemize

\item something cool
\item something else cool

\stopitemize
\stopsection

\startsection[title={Main strands of theory}]
\TOC
\startitemize

\item another cool thing
\item cool too

\stopitemize
\stopsection


\stoptext

Thanks in advance.

Jethro
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Writing Tabular with \Vert

2022-12-21 Thread Jethro Djan via ntg-context
Maybe try:

\starttable
\bTD $\Vert r1c1\Vert$ \eTD
…
\stoptable

On Wed, 21 Dec 2022 at 11:39, Ursula Hermann via ntg-context <
ntg-context@ntg.nl> wrote:

> Dear List,
>
> In this tabular I wanted to set \Vert. But when I compile it,
>
> \starttable
>
>   \bTD \Vert r1c1\Vert
>
>   \bTD \bf r1c2 \eTD
>
>   \bTD \bf r1c3 \eTD
>
>   \bTD \bf r1c4 \eTD
>
> \eTR
>
> \bTR
>
>   \bTD r2c1 \eTD
>
>   \bTD r2c2 \eTD
>
>   \bTD[nr=2] r2c3 \eTD
>
>   \bTD r2c4 \eTD
>
> \eTR
>
> \bTR
>
>   \bTD r3c1 \eTD
>
>   \bTD r3c2 \eTD
>
>   \bTD r3c4 \eTD
>
> \eTR
>
> \bTR
>
>   \bTD r4c1 \eTD
>
>   \bTD r4c2 \eTD
>
>   \bTD[nr=3] r4c3 \eTD
>
>   \bTD[nr=3] r4c4 \eTD
>
> \eTR
>
> \bTR
>
>   \bTD r5c1 \eTD
>
>   \bTD r5c2 \eTD
>
> \eTR
>
> \bTR
>
>   \bTD r6c1 \eTD
>
>   \bTD r6c2 \eTD
>
> \eTR
>
> \stoptable
>
>
>
> I get this :
>
> Command Line:   C:\texlive\2022\bin\win32\context.exe --synctex=1
> "Tabular.tex"
>
> Startup Folder: C:\texlive\My Documents\My Documents
>
>
>
>
>
> resolvers   | formats | executing runner 'run luatex format':
> C:/texlive/2022/bin/win32/luatex --jobname="Tabular"
> --fmt=C:/texlive/2022/texmf-var/luatex-cache/context/a86c089b384a3076dc514ba966a1fac9/formats/luatex/cont-en.fmt
> --lua=C:/texlive/2022/texmf-var/luatex-cache/context/a86c089b384a3076dc514ba966a1fac9/formats/luatex/cont-en.lui
> cont-yes.mkiv --c:currentrun=1 --c:fulljobname="./Tabular.tex"
> --c:input="./Tabular.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:synctex="1"
> --c:texmfbinpath="C:/texlive/2022/bin/win32"
>
> This is LuaTeX, Version 1.15.0 (TeX Live 2022)
>
>  system commands enabled.
>
> open source > level 1, order 1, name
> 'C:/texlive/2022/texmf-dist/tex/context/base/mkiv/cont-yes.mkiv'
>
> system  >
>
> system  > ConTeXt  ver: 2021.03.05 19:11 MKIV  fmt: 2022.10.11
> int: english/english
>
> system  >
>
> system  > 'cont-new.mkiv' loaded
>
> open source > level 2, order 2, name
> 'C:/texlive/2022/texmf-dist/tex/context/base/mkiv/cont-new.mkiv'
>
> system  > beware: some patches loaded from cont-new.mkiv
>
> close source> level 2, order 2, name
> 'C:/texlive/2022/texmf-dist/tex/context/base/mkiv/cont-new.mkiv'
>
> system  > files > jobname 'Tabular', input './Tabular', result
> 'Tabular'
>
> fonts   > latin modern fonts are not preloaded
>
> languages   > language 'en' is active
>
> system  > synctex functionality is enabled, expect 5-10 pct
> runtime overhead!
>
> open source > level 2, order 3, name 'C:/texlive/My Documents/My
> Documents/Tabular.tex'
>
> fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
>
>
>
> tex error   > tex error on line 2 in file C:/texlive/My Documents/My
> Documents/Tabular.tex: ! Use of \csname\endcsname doesn't match its
> definition
>
>
>
>
>
> \tabl_table_restart_indeed #1->\gdef \tabl_table_restart
> {#1}\tabl_table_restart \tabl_table_insert_head
>
>   
>\ifsplittables
> \ifconditional \c_tabl_table_repeat_tail \tablenoalign {\goodbreak
> }\tabl_table_insert_tail \tablenoalign {\goodbreak }\fi \fi
>
> 
>
> \bTD
>
> l.2   \bTD
>
>  \Vert r1c1\Vert
>
>
>
> 1 \starttable
>
>  2 >>\bTD \Vert r1c1\Vert
>
> 3   \bTD \bf r1c2 \eTD
>
> 4   \bTD \bf r1c3 \eTD
>
> 5   \bTD \bf r1c4 \eTD
>
> 6 \eTR
>
> 7 \bTR
>
> 8   \bTD r2c1 \eTD
>
> 9   \bTD r2c2 \eTD
>
> 10   \bTD[nr=2] r2c3 \eTD
>
> 11   \bTD r2c4 \eTD
>
> 12 \eTR
>
>
>
> mtx-context | fatal error: return code: 1
>
> How can I write it in the right way?
>
> Uschi
>
>
>
>
>
> _
>
>
>
> ConTeXt Compilation Report (Pages: 0)
>
>
>
> Errors: 1   Warnings: 0   Bad Boxes: 0
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Command line arguments on context project

2022-12-16 Thread Jethro Djan via ntg-context
Dear list,

I am using the project structure to typeset my thesis. This is how the 
directory looks like:

chapters/chapter1.tex
chapters/chapter2.tex
…

output/
env_thesis.tex
prd_main.tex
ref.bib

I didn’t use the project.

1. How do I specify output directory?

I have already seen the following thread:

https://www.mail-archive.com/ntg-context@ntg.nl/msg101654.html 


It doesn’t seem to work on a project. So for example when I run mtxrun 
—path=output --script context ../prd_main, I get this error: 

tex error on line 5 in file 
/usr/local/texlive/2022/texmf-dist/doc/latex/buctthesis/chapter1.tex: ! 
Undefined control sequence

2. How do I get CoTeXt to recognise the ref.bib file when I run the components 
not the product?

For context, I don’t want the references printed at the end of each chapter but 
I would like the in-text citation to work (if that is possible). If not, is it 
possible compile the whole product but only output a certain page range?

Jethro___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Achieving different \cite styles

2022-12-08 Thread Jethro Djan via ntg-context
Hello everyone

I am interested in being able to cite in different ways. By analogy, I
refer to the \texcite{}, \parencite{} and other options available with
biblatex in LaTeX. How do I achieve something like \textcite{} in ConTeXt?
Here is my MWE:

\startbuffer[ref]

@Article{wn:2017,
  author  = {Who, Nobody and What, Everyone},
  journal = {Good Journal},
  title   = {The Art of Being},
  year= {2017},
}

\stopbuffer

\definebtxdataset[ref]
\usebtxdataset[ref][ref.buffer]
\setupbtx[
  dataset=ref,
]
\definebtxrendering
  [ref]
  [apa]
  [
  dataset=ref,
  ]
\usebtxdefinitions[apa]

\starttext

In \cite[wn:2017], they illustrated that it is impossible to not be them.
\cite[wn:2017] said it was worth the discovery.

\startsection[title={References}, number=no, incrementnumber=no]
\placelistofpublications[ref][method=dataset]
\stopsection

\stoptext

The first sentence is okay. In the second, I would like the parenthesis
around the citation to come off because of the way I am citing it.

Jethro
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Command for specifying et al limit

2022-09-24 Thread Jethro Djan via ntg-context
Dear list,

I am trying to specify that 'et al’ should be appended after the first author 
if paper has multiple authors. It seems from the mkiv-publications.pdf manual 
that it should work like this but it doesn’t. Here is my MWE:

\startbuffer[ref]

@Article{bb:2017,
  author  = {Bronstein, Michael M. and Bruna, Joan and Cohen, Taco and 
Veličković, Petar},
  journal = {arXiv preprint arXiv:2104.13478},
  title   = {Geometric Deep Learning: Grids, Groups, Graphs, Geodesics, and 
Gauges},
  year= {2021},
}

\stopbuffer

\definebtxdataset[ref]
\setupbtx[dataset=ref]
\definebtxrendering
[ref]
[apa]
[
dataset=ref,
]
\usebtxdefinitions[apa]
\usebtxdataset[ref][ref.buffer]
\setupbtx[
  dataset=ref,
  etaldisplay = 1,
  etallimit = 1,
]

\starttext

\cite[author][bb:2017] says in their paper \cite[bb:2017] 

\startsection[title={References}, number=no, incrementnumber=no]
\placelistofpublications[ref][method=dataset]
\stopsection

\stoptext

Thanks in advance.

Jethro



___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-23 Thread Jethro Djan via ntg-context
Hello,

Thanks to Pablo and Aditya for the solutions. Sometimes it is very
difficult to find the right manuals and info for what you want to achieve
for those of us new to ConTeXt. I found the stuff on
context(context.noffigurepages) here (
https://wiki.contextgarden.net/Image_Placement) and I didn’t know the
manual you linked to existed. I have also been searching for stuff about
“low-level” stuff in ConTexT like the \doloopoverlist command.

I hope to contribute to the online wiki as I become a better user of
ConTeXt.

On Tue, Aug 23, 2022 at 3:58 PM Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

> On 8/22/22 17:46, Jethro Djan via ntg-context wrote:
> > Thanks for the solution Pablo. It works well.
>
> Glad to read it worked for you, Jethro.
>
> > I wanted to add more pdfs (which also has many pages) and found it
> > was easier for me to reason in the lua side of things. This is what I
> > have at the moment:
>
> I think this might be what you intend:
>
>   \setuplayout[page]
>   \starttext
>   \doloopoverlist{ass1,ass2,ass3,ass4,ass5,ass6,ass7,ass8}
> {\def\Doc{\recursestring.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>  {\externalfigure[\Doc]
>[page=\recurselevel, width=20cm, scale=950]}}
>   \stoptext
>
> > I didn’t know how to get an array (or indexed table or whatever you
> > call it) in ConTeXt/Tex.
>
> \doloopoverlist & \recursestring are your friends here.
>
> > My problem is now with context(context.noffigurepages). Am I calling
> > it wrong? All I want to do is call \noffigurepages from the lua side.
> > Is there something I am missing?
>
> The approach is totally different: "getnofpages"
> (
> http://www.pragma-ade.com/general/manuals/luametatex.pdf#search=getnofpages
> ).
>
> BTW, your code crashed my session, CPU goes to 100% and RAM usage too. I
> wonder how your sample could be compiled fine by your system.
>
> I hope it helps,
>
> Pablo
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context

Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was easier 
for me to reason in the lua side of things. This is what I have at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1 
repeat 
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7", 
"ass8"}
  for index=1,#pdffiles do 
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call it) in 
ConTeXt/Tex. My problem is now with context(context.noffigurepages). It doesn’t 
produce an integer so n is being compared to nil. Am I calling it wrong? All I 
want to do is call \noffigurepages from the lua side. Is there something I am 
missing?

Jethro

> On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
>> Hello,
>> 
>> I am trying to put multiple PDF’s that were typeset differently into
>> one document without modifying the individual files themselves.
>> [...]
>> The problem is the original page numbers show and I’d prefer that it
>> did not. So I thought maybe I could clip all the page numbers from
>> every page (since they are all in the same position across all the
>> pages) but I don’t know how to do this with the \clip command. Any
>> ideas? I already tried using \input but it gives some weird output in
>> some places. It doesn’t have to use this method as long as it does
>> what I need it to do.
> 
> Hi Jethro,
> 
> it works using \clip with \externalfigure inside a loop (\dorecurse).
> 
> With \getfiguredimensions you get the number of pages of each PDF
> document (\noffigurepages).
> 
> The following source both generates the source PDF document and the
> imposed result with clipped pages (just to see a sample of the commands
> mentioned above):
> 
>  \startbuffer[newbuff]
>  \setuppapersize[A3]
>  \setupbodyfont[sans, 1200pt]
>  \starttext
>  \dorecurse{8}
>  {\startmakeup[page][pagestate=start, align=center, style=\bf]
>\recurselevel
>   \stopmakeup}
>  \stoptext
>  \stopbuffer
>  \startmode[*first]
>  \savebuffer[newbuff][source_page.tex, prefix=no]
>  \executesystemcommand{context --purgeall source_page.tex}
>  \stopmode
>  \setuplayout[page]
>  \setuppapersize[A6][A4]
>  \setuppaper[nx=2, ny=2]
>  \setuparranging [XY]
>  \starttext
>  \startnotmode[*first]
>  \def\Doc{source_page.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
>{\externalfigure[\Doc][page=\recurselevel]}}
>  \stopnotmode
>  \stoptext
> 
> Just in case it might help,
> 
> Pablo
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context

Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was easier 
for me to reason in the lua side of things. This is what I have at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1 
repeat 
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7", 
"ass8"}
  for index=1,#pdffiles do 
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call it) in 
ConTeXt/Tex. My problem is now with context(context.noffigurepages). Am I 
calling it wrong? All I want to do is call \noffigurepages from the lua side. 
Is there something I am missing?

Jethro

> On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
>> Hello,
>> 
>> I am trying to put multiple PDF’s that were typeset differently into
>> one document without modifying the individual files themselves.
>> [...]
>> The problem is the original page numbers show and I’d prefer that it
>> did not. So I thought maybe I could clip all the page numbers from
>> every page (since they are all in the same position across all the
>> pages) but I don’t know how to do this with the \clip command. Any
>> ideas? I already tried using \input but it gives some weird output in
>> some places. It doesn’t have to use this method as long as it does
>> what I need it to do.
> 
> Hi Jethro,
> 
> it works using \clip with \externalfigure inside a loop (\dorecurse).
> 
> With \getfiguredimensions you get the number of pages of each PDF
> document (\noffigurepages).
> 
> The following source both generates the source PDF document and the
> imposed result with clipped pages (just to see a sample of the commands
> mentioned above):
> 
>  \startbuffer[newbuff]
>  \setuppapersize[A3]
>  \setupbodyfont[sans, 1200pt]
>  \starttext
>  \dorecurse{8}
>  {\startmakeup[page][pagestate=start, align=center, style=\bf]
>\recurselevel
>   \stopmakeup}
>  \stoptext
>  \stopbuffer
>  \startmode[*first]
>  \savebuffer[newbuff][source_page.tex, prefix=no]
>  \executesystemcommand{context --purgeall source_page.tex}
>  \stopmode
>  \setuplayout[page]
>  \setuppapersize[A6][A4]
>  \setuppaper[nx=2, ny=2]
>  \setuparranging [XY]
>  \starttext
>  \startnotmode[*first]
>  \def\Doc{source_page.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
>{\externalfigure[\Doc][page=\recurselevel]}}
>  \stopnotmode
>  \stoptext
> 
> Just in case it might help,
> 
> Pablo
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context
Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was
easier for me to reason in the lua side of things. This is what I have
at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1
repeat
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7",
"ass8"}
  for index=1,#pdffiles do
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call
it) in ConTeXt/Tex. My problem is now with context(context.noffigurepages).
Am I calling it wrong? All I want to do is call \noffigurepages from the
lua side. Is there something I am missing?

Jethro

On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

On 8/18/22 02:13, jethro Reuel via ntg-context wrote:

Hello,

I am trying to put multiple PDF’s that were typeset differently into
one document without modifying the individual files themselves.
[...]
The problem is the original page numbers show and I’d prefer that it
did not. So I thought maybe I could clip all the page numbers from
every page (since they are all in the same position across all the
pages) but I don’t know how to do this with the \clip command. Any
ideas? I already tried using \input but it gives some weird output in
some places. It doesn’t have to use this method as long as it does
what I need it to do.


Hi Jethro,

it works using \clip with \externalfigure inside a loop (\dorecurse).

With \getfiguredimensions you get the number of pages of each PDF
document (\noffigurepages).

The following source both generates the source PDF document and the
imposed result with clipped pages (just to see a sample of the commands
mentioned above):

 \startbuffer[newbuff]
 \setuppapersize[A3]
 \setupbodyfont[sans, 1200pt]
 \starttext
 \dorecurse{8}
 {\startmakeup[page][pagestate=start, align=center, style=\bf]
   \recurselevel
  \stopmakeup}
 \stoptext
 \stopbuffer
 \startmode[*first]
 \savebuffer[newbuff][source_page.tex, prefix=no]
 \executesystemcommand{context --purgeall source_page.tex}
 \stopmode
 \setuplayout[page]
 \setuppapersize[A6][A4]
 \setuppaper[nx=2, ny=2]
 \setuparranging [XY]
 \starttext
 \startnotmode[*first]
 \def\Doc{source_page.pdf}
 \getfiguredimensions[\Doc]
 \dorecurse{\noffigurepages}
   {\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
   {\externalfigure[\Doc][page=\recurselevel]}}
 \stopnotmode
 \stoptext

Just in case it might help,

Pablo
___
If your question is of interest to others as well, please add an entry to
the Wiki!

maillist : ntg-context@ntg.nl /
https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] underbrace under matrix

2022-08-05 Thread Jethro Djan via ntg-context
Hi,

I will wait for the manual. With drawing commutative diagrams, I am sure 
learning how to use MetaFun/MetaPost better might help.

Thanks for the fantastic work.

Jethro

> On 5 Aug 2022, at 3:27 PM, Hans Hagen via ntg-context  
> wrote:
> 
> On 8/5/2022 5:12 PM, Jethro Djan via ntg-context wrote:
>> Hello Mikael,
>> Thanks for your solution; it works just fine. I am not familiar with how you 
>> defined the pmatrix. Any links to manuals to learn such definitions? Also, 
>> this is the second thing I have tried to adapt from typesetting mathematics 
>> in plain TeX that didn’t work. I tried to draw commutative diagrams some 
>> time back using \diagram{…} which didn’t work(Got the idea from the book “A 
>> beginner’s book of TeX” pg. 161 by Seroul et al ).
>> I guess what I am asking is that, what are the limits of what I can use 
>> out-of-the-box from Tex when typesetting mathematics? I have read Aditya’s 
>> ConTeXt-LaTeX tutorial which is fantastic. But the stuff illustrated there 
>> are quite limited. Are there any materials I can read on this?
> there is an extensive manual coming but you need to give us some time (as it 
> goes hand-in-hand with updating / extending some of the math machinery)
> 
> if you have specific wishes, just let is know and we'll have a look if it can 
> somehow fit in
> 
> Hans
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] underbrace under matrix

2022-08-05 Thread Jethro Djan via ntg-context
Hello Mikael,

Thanks for your solution; it works just fine. I am not familiar with how you 
defined the pmatrix. Any links to manuals to learn such definitions? Also, this 
is the second thing I have tried to adapt from typesetting mathematics in plain 
TeX that didn’t work. I tried to draw commutative diagrams some time back using 
\diagram{…} which didn’t work(Got the idea from the book “A beginner’s book of 
TeX” pg. 161 by Seroul et al ). 

I guess what I am asking is that, what are the limits of what I can use 
out-of-the-box from Tex when typesetting mathematics? I have read Aditya’s 
ConTeXt-LaTeX tutorial which is fantastic. But the stuff illustrated there are 
quite limited. Are there any materials I can read on this?

Thanks for your help.

Jethro



> On 5 Aug 2022, at 5:03 AM, Mikael Sundqvist via ntg-context 
>  wrote:
> 
> \definemathmatrix[pmatrix][matrix:parentheses][
> simplecommand=pmatrix,
> ]

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] underbrace under matrix

2022-08-04 Thread Jethro Djan via ntg-context
Hello,

I want to get underbraces under matrices in a math alignment environment. I’ve 
reproduced my problem here:

 \definemathmatrix  
   
   [pmatrix]
   
   [left={\left(\,},right={\,\right)}]   
  
 \starttext 

  
 \placeformula[-]\startformula\startmathalignment   
   
   \NC\ 
   
   A \NC=\underbrace{   
   
   \startpmatrix
   
 \NC 5\NC 5\NR  
   
 \NC -1\NC 7\NR 
   
   \stoppmatrix}\NR 
   
   \NC\NC=\underbrace{  
   
   \startpmatrix
   
 \NC 2\NC 1\NR  
   
 \NC 4\NC 2\NR  
   
  \stoppmatrix}\NR  
  
 \stopmathalignment\stopformula 


  \stoptext  

How can I achieve this?

Jethro
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___