Re: [NTG-context] Fonts from various .otf to work with \bold, \emph, \bf, \bfa ...
Hello Pablo, thank you for showing the way; unfortunately, still something is missing: - the resulting file uses LMRoman instead of WorkSans, - the log confirms: "selectfont > The requested font 'WorkSans' has no files for the 'tf' alternative, Latin Modern is used instead". - Note that all WorkSans files: work-sans.bold.otf work-sans.bold-italic.otf work-sans.light.otf work-sans.light-italic.otf are placed in the same directory as the main source file. (I can zip them and upload somewhere for testing purposes.) - In your code bellow, I cann't see any link to any work-sans .otf file name. - Does it mean that that ConTeXt browses its database of "known" fonts, searches for all fonts which contain "identification" as "WorkSans" (given from your \definefontfamily...[WorkSans])? - Also, I see assignments [tf={style:light},it={style:lightitalic}]: - Should also an assignment for "bf=[style:...]" be provided? - How ConTeXt gets to know from "it={style:lightitalic}" that file "work-sans.light-italic.otf" should be used? Sorry for elementary questions, I'm still "in captivity" of swtching fonts, their styles and font sizes by clicking a combo in Word toolbar (although I quit using Word about 15 ys ago). And although I'm aware of different dealing with fonts in TeX (and in professional typesetting in general), it's often difficult for me to imagine how exactly TeX switchches fonts, what is the relationship between (and how the comands cooperate) \definefontfamily, \setupbodyfontenvironment, \setupbodyfont, \definefontsynonym, \definefont, typescripts, simplefonts module and also what is the relations among parameters to the-above commands. So any practical samples (e.g. here discussed) helps me much. Best regards, Lukas Hi Lukas, I think this is what you might need: \definefontfamily [mainface] [rm] [WorkSans] [tf={style:light}, it={style:lightitalic}] \setupbodyfont[mainface] \setupbodyfontenvironment [default] [a=1.2, b=2.4, c=3.6, d=4.8, em=italic] \starttext \startTEXpage[offset=1em] roman\\ {\bf bold}\\ {\it italic}\\ {\bi bold italic}\\ {\tfa roman}\\ {\bfb bold}\\ {\itc italic}\\ {\bid bold italic}\\ \stopTEXpage \stoptext I hope it helps, Pablo -- http://www.ousia.tk ___ 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 ___ open source > level 1, order 1, name 'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv' system > system > ConTeXt ver: 2019.12.31 11:28 MKIV beta fmt: 2020.1.8 int: english/english system > system > 'cont-new.mkiv' loaded open source > level 2, order 2, name 'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv' system > beware: some patches loaded from cont-new.mkiv close source> level 2, order 2, name 'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv' system > jobfiles > using path: d:\\Lukas\\ConTeXt\\Styles system > files > jobname 't-Font', input 'D:\\Lukas\\Jobs\\KatMostu.TP\\Test\\t-Font.mkiv', result 't-Font' fonts > latin modern fonts are not preloaded languages > language 'en' is active open source > level 2, order 3, name 'D://Lukas/Jobs/KatMostu.TP/Test/t-Font.mkiv' selectfont > The requested font 'WorkSans' has no files for the 'tf' alternative, Latin Modern is used instead. fonts > preloading modern-designsize (math) fonts > typescripts > unknown library 'modern-designsize' fonts > 'fallback modern-designsize mm 12pt' is loaded fonts > preloading modern-designsize (mono) fonts > 'fallback modern-designsize tt 12pt' is loaded backend > xmp > using file 'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml' pages > flushing realpage 1, userpage 1, subpage 1 close source> level 2, order 3, name 'D://Lukas/Jobs/KatMostu.TP/Test/t-Font.mkiv' close source> level 1, order 3, name 'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv' system > start used files system > text: t-Font system > stop used files system > start used files system >1: filename=char-prv.lua filetype=tex format=tex foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/char-prv.lua fullname=d:/Ctx-Beta/tex/texmf-cont
Re: [NTG-context] repeat a page inside a document
On Thu, 6 Feb 2020 22:04:47 +0100 Pablo Rodriguez wrote: > On 2/6/20 8:17 PM, Wolfgang Schuster wrote: > > On Thu, 6 Feb 2020 19:02:08 +0100 Pablo Rodriguez wrote: > >> [...] > >> BTW, in my real-world document I use layers which are different for > >> first and other pages. > > > > How many pages has your document, first you write is has only > > one page but now you write about a document with many pages. > > Sorry for the inaccuracies in my previous description, Wolfgang. > > I use a single source combined with data read from CSV files to generate > documents which may contain a single or more than one page. > > I assumed that modes were persistent across runs. And maybe they aren’t > or my approach is wrong. > > >> Could you provide a minimal sample showing how a component may include a > >> page twice? > > > > Can you provide a minimal example of your document because > > there is no solution which works for all cases. > > The sample that seems to work is the following (too tricky for my taste > and I have to adapt it to Windows): > > \installshipoutmethod{savepages} > {\dowithnextbox > {\invokepagehandler{normal}{\copy\nextbox}% > \putboxincache{savedpages}{\number\realpageno}\nextbox} >\hbox} > > \setuppaper[method=savepages] > > \starttext > > \scale[width=\textwidth]{a} > \scale[width=\textwidth]{b} > > \doifmode{*first}{\executesystemcommand{rm zikaasd.abh}} > > \startnotmode[*first] > \ifnum\lastpagenumber<2 > \executesystemcommand{touch zikaasd.abh} > \fi > > \doiffileexistselse{zikaasd.abh}{% > \startlayout[page] > \directboxfromcache{savedpages}{1} > \stoplayout}{} > \stopnotmode > > \stoptext > > I wonder whether there is a better way of doing this. > > At least, creating and removing empty files with Lua would be more > portable. And not having to use an external file would be better. Your example is still very confusing and I have no idea what you're trying to achieve. They way to go depends also what you try to achieve, when you need an exact copy of the first page the above is the way to go. Another way is to use a make file (or a ctx-file for ConTeXt) to add a image of the first page to your document afterwards. Wolfgang ___ 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 ___
Re: [NTG-context] repeat a page inside a document
On 2/6/20 8:17 PM, Wolfgang Schuster wrote: > On Thu, 6 Feb 2020 19:02:08 +0100 Pablo Rodriguez wrote: >> [...] >> BTW, in my real-world document I use layers which are different for >> first and other pages. > > How many pages has your document, first you write is has only > one page but now you write about a document with many pages. Sorry for the inaccuracies in my previous description, Wolfgang. I use a single source combined with data read from CSV files to generate documents which may contain a single or more than one page. I assumed that modes were persistent across runs. And maybe they aren’t or my approach is wrong. >> Could you provide a minimal sample showing how a component may include a >> page twice? > > Can you provide a minimal example of your document because > there is no solution which works for all cases. The sample that seems to work is the following (too tricky for my taste and I have to adapt it to Windows): \installshipoutmethod{savepages} {\dowithnextbox {\invokepagehandler{normal}{\copy\nextbox}% \putboxincache{savedpages}{\number\realpageno}\nextbox} \hbox} \setuppaper[method=savepages] \starttext \scale[width=\textwidth]{a} \scale[width=\textwidth]{b} \doifmode{*first}{\executesystemcommand{rm zikaasd.abh}} \startnotmode[*first] \ifnum\lastpagenumber<2 \executesystemcommand{touch zikaasd.abh} \fi \doiffileexistselse{zikaasd.abh}{% \startlayout[page] \directboxfromcache{savedpages}{1} \stoplayout}{} \stopnotmode \stoptext I wonder whether there is a better way of doing this. At least, creating and removing empty files with Lua would be more portable. And not having to use an external file would be better. Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 ___
Re: [NTG-context] Fonts from various .otf to work with \bold, \emph, \bf, \bfa ...
On 2/6/20 10:04 AM, cont...@vivaldi.net wrote: > Hello, > > although font switching used to be discussed here and I studied wiki > about font changing, I don't switch fonts in ConTeXt very often and my > "maximum" font change was provided by \setupbodyfont[(e.g. termes)]. > [...] > so that: > > - normal text and math (nothing special - just subscripts) would be > typeset with work-sans.light.otf > - \bold (\bf) would use work-sans.bold.otf, > - \emph (\em and \it) would use work-sans.light-italic.otf, > - \bi would use work-sans.bold-italic.otf > - also commands \bfa, \bfc, ... would use work-sans.bold.otf scaled > somehow (probably by multiples of 1.2). > > Some help setting it up and making it work would be appreciated... Hi Lukas, I think this is what you might need: \definefontfamily [mainface] [rm] [WorkSans] [tf={style:light}, it={style:lightitalic}] \setupbodyfont[mainface] \setupbodyfontenvironment [default] [a=1.2, b=2.4, c=3.6, d=4.8, em=italic] \starttext \startTEXpage[offset=1em] roman\\ {\bf bold}\\ {\it italic}\\ {\bi bold italic}\\ {\tfa roman}\\ {\bfb bold}\\ {\itc italic}\\ {\bid bold italic}\\ \stopTEXpage \stoptext I hope it helps, Pablo -- http://www.ousia.tk ___ 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 ___
Re: [NTG-context] repeat a page inside a document
On Thu, 6 Feb 2020 19:02:08 +0100 Pablo Rodriguez wrote: > On 2/6/20 5:15 PM, Henning Hraban Ramm wrote: > > > >> Am 2020-02-06 um 16:28 schrieb Pablo Rodriguez : > >> > >> My question is how to get a page from the document you‘re compiling > >> repeated inside the same document. > > > > I solved this with a component that I include twice. Of course that > > won’t work if you need a page in the middle of some text flow. > > Many thanks for your reply, Hraban. > > I don’t need a page in the middle of the text. > > I need a single page document to be printed twice and doublesided. > > I’m afraid I’d never used components and I cannot understand how this > would help to replicate the previous page in a document. > > BTW, in my real-world document I use layers which are different for > first and other pages. How many pages has your document, first you write is has only one page but now you write about a document with many pages. > Could you provide a minimal sample showing how a component may include a > page twice? Can you provide a minimal example of your document because there is no solution which works for all cases. Wolfgang ___ 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 ___
Re: [NTG-context] repeat a page inside a document
On 2/6/20 7:14 PM, Wolfgang Schuster wrote: > On Thu, 6 Feb 2020 16:28:04 +0100 Pablo Rodriguez wrote: >> [...] >> My question is how to get a page from the document you‘re compiling >> repeated inside the same document. >> >> I have tried to search both i-context.pdf and the wiki, but “mirror” and >> “repeat” seem to be bad options. > > You can store each finished page in a box and access the content > of the stored box afterwards. Huge thanks for your reply and the code, Wolfgang. I have just checked “TeX for the Impatient” to understand what shipout methods and boxes were. I think I can barely grasp their meaning. Which are other usages for shipouts and boxes? I guess they are used to add pages in the final PDF document, but I don’t see which other uses they may have. BTW, “invokepagehandler” reads “invokepageheandler” in the following files from the ConTeXt Suite (I don’t know whether the first is the real source of the rest of them): * texmf-context/tex/context/interface/mkiv/i-imposition.xml * texmf-context/tex/context/interface/mkiv/context-en.xml * texmf-context/context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json * texmf-context/context/data/textadept/context/data/scite-context-data-interfaces.lua * texmf-context/context/data/scite/context/lexers/data/scite-context-data-interfaces.lua * texmf-context/context/data/scite/context/scite-context-data-interfaces.properties Many thanks again for your help, Pablo > \installshipoutmethod{savepages} > {\dowithnextbox > {\invokepagehandler{normal}{\copy\nextbox}% > \putboxincache{savedpages}{\number\realpageno}\nextbox} >\hbox} > > \setuppaper[method=savepages] > > \starttext > > \dorecurse{8} > {\expanded{\chapter{Chapter \recurselevel}} >\dorecurse{\recurselevel}{\samplefile{weisman}}} > > \startlayout[page] > \directboxfromcache{savedpages}{5} > \page > \directboxfromcache{savedpages}{2} > \stoplayout > > \stoptext -- http://www.ousia.tk ___ 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 ___
Re: [NTG-context] repeat a page inside a document
On 2/6/20 5:39 PM, Thomas Savary wrote: > Hi, Pablo ! > > Funny, I asked the same kind of question in a LaTeX mailing list a few > days ago. The anwer I was given requires a LaTeX package, but is written > in TeX as well, so it may be easy to adapt it for ConTeXt. Sorry, I > cannot do that myself yet. I have just started to learn ConTeXt and am a > very busy slow learner. > > \usepackage{atbegshi} > \newcommand{\Repeat}{} > > \AtBeginShipout{% > \ifodd\value{page}% > \else\Repeat% > \newpage% > \fi% Many thanks for your reply, Thomas. I don’t think this would work, since I need to impose a full page from the same document in a new one (without resizing or rotating it). I mean, from what I see in that approach, I would have a hard time fitting all page contents with layers inside a single command. But please, let me know what I may be missing here, if I’m wrong. Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 ___
Re: [NTG-context] repeat a page inside a document
On Thu, 6 Feb 2020 16:28:04 +0100 Pablo Rodriguez wrote: > Dear list, > > I have the following sample: > > \starttext > \input knuth > \page[right] > \setuplayout[page] > \externalfigure[\jobname.pdf][page=1] > \stoptext > > My question is how to get a page from the document you‘re compiling > repeated inside the same document. > > I have tried to search both i-context.pdf and the wiki, but “mirror” and > “repeat” seem to be bad options. You can store each finished page in a box and access the content of the stored box afterwards. \installshipoutmethod{savepages} {\dowithnextbox {\invokepagehandler{normal}{\copy\nextbox}% \putboxincache{savedpages}{\number\realpageno}\nextbox} \hbox} \setuppaper[method=savepages] \starttext \dorecurse{8} {\expanded{\chapter{Chapter \recurselevel}} \dorecurse{\recurselevel}{\samplefile{weisman}}} \startlayout[page] \directboxfromcache{savedpages}{5} \page \directboxfromcache{savedpages}{2} \stoplayout \stoptext Wolfgang ___ 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 ___
Re: [NTG-context] repeat a page inside a document
On 2/6/20 5:15 PM, Henning Hraban Ramm wrote: > >> Am 2020-02-06 um 16:28 schrieb Pablo Rodriguez : >> >> My question is how to get a page from the document you‘re compiling >> repeated inside the same document. > > I solved this with a component that I include twice. Of course that > won’t work if you need a page in the middle of some text flow. Many thanks for your reply, Hraban. I don’t need a page in the middle of the text. I need a single page document to be printed twice and doublesided. I’m afraid I’d never used components and I cannot understand how this would help to replicate the previous page in a document. BTW, in my real-world document I use layers which are different for first and other pages. Could you provide a minimal sample showing how a component may include a page twice? Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 ___
Re: [NTG-context] repeat a page inside a document
Hi, Pablo ! Funny, I asked the same kind of question in a LaTeX mailing list a few days ago. The anwer I was given requires a LaTeX package, but is written in TeX as well, so it may be easy to adapt it for ConTeXt. Sorry, I cannot do that myself yet. I have just started to learn ConTeXt and am a very busy slow learner. \usepackage{atbegshi} \newcommand{\Repeat}{} \AtBeginShipout{% \ifodd\value{page}% \else\Repeat% \newpage% \fi% } I hope it helps. But maybe you don’t need to repeat the same page every two page, as I did… Thomas Savary 1 le Grand-Plessis F-85340 L’Île-d’Olonne Tél. 06 22 82 61 34 https://correctionpro.fr/ https://compo85.fr/ jeudi 6 février 2020, à 16:28:04 CET, Pablo Rodriguez a écrit : > Dear list, > > I have the following sample: > > \starttext > \input knuth > \page[right] > \setuplayout[page] > \externalfigure[\jobname.pdf][page=1] > \stoptext > > My question is how to get a page from the document you‘re compiling > repeated inside the same document. > > I have tried to search both i-context.pdf and the wiki, but “mirror” and > “repeat” seem to be bad options. > > Many thanks in advance, > > Pablo > -- > http://www.ousia.tk > > ___ 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 > > ___ ___ 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 ___
Re: [NTG-context] repeat a page inside a document
> Am 2020-02-06 um 16:28 schrieb Pablo Rodriguez : > > My question is how to get a page from the document you‘re compiling > repeated inside the same document. I solved this with a component that I include twice. Of course that won’t work if you need a page in the middle of some text flow. Greetlings, Hraban --- https://www.fiee.net http://wiki.contextgarden.net https://www.dreiviertelhaus.de GPG Key ID 1C9B22FD ___ 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 ___
[NTG-context] repeat a page inside a document
Dear list, I have the following sample: \starttext \input knuth \page[right] \setuplayout[page] \externalfigure[\jobname.pdf][page=1] \stoptext My question is how to get a page from the document you‘re compiling repeated inside the same document. I have tried to search both i-context.pdf and the wiki, but “mirror” and “repeat” seem to be bad options. Many thanks in advance, Pablo -- http://www.ousia.tk ___ 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 ___
[NTG-context] Fonts from various .otf to work with \bold, \emph, \bf, \bfa ...
Hello, although font switching used to be discussed here and I studied wiki about font changing, I don't switch fonts in ConTeXt very often and my "maximum" font change was provided by \setupbodyfont[(e.g. termes)]. Now I am in the situation that I need to use fonts defined in: work-sans.bold.otf work-sans.bold-italic.otf work-sans.light.otf work-sans.light-italic.otf (all from https://www.1001fonts.com/work-sans-font.html) so that: - normal text and math (nothing special - just subscripts) would be typeset with work-sans.light.otf - \bold (\bf) would use work-sans.bold.otf, - \emph (\em and \it) would use work-sans.light-italic.otf, - \bi would use work-sans.bold-italic.otf - also commands \bfa, \bfc, ... would use work-sans.bold.otf scaled somehow (probably by multiples of 1.2). Some help setting it up and making it work would be appreciated... Best regards, Lukas ___ 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 ___