Re: [NTG-context] counting characters when dealing with XML
On 01/21/2015 12:36 AM, Hans Hagen wrote: On 1/20/2015 8:50 PM, Pablo Rodriguez wrote: Dear list, I have a question when dealing with XML. Is there any way to write a conditional based on the number of characters in a given field? [...] let tex do the work .. counting is not accurate for this anyway Many thanks for your reply, Hans. I don’t need total accuracy with this. Many thanks for your help again, Pablo \starttexdefinition AutoFontSize #1 \begingroup \setbox\scratchbox\hbox{#1} \normalexpanded { \definedfont[Regular*default at \ifdim\wd\scratchbox30em 10pt\else \ifdim\wd\scratchbox25em 12pt\else \ifdim\wd\scratchbox20em 14pt\else \ifdim\wd\scratchbox15em 16pt\fi\fi\fi\fi ] } #1 \endgroup \stoptexdefinition \starttext \dostepwiserecurse{30}{80}{2}{\AutoFontSize{\dorecurse{#1}{x}}\par} \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] bug when dealing with XML classes?
Hans, I have the following sample: \setupbodyfont[30pt] \startbuffer[demo] doc h1This is my title/h1 div class=section class=level1 class=hidden h1This title is hidden/h1 /div div class=section level1 hidden h1This title is not hidden/h1 pText/p /div /doc \stopbuffer \starttext \startxmlsetups xml:initialize \xmlsetsetup{#1}{div}{xml:div} \xmlsetsetup{#1}{h1}{xml:h1} \xmlsetsetup{\xmldocument}{[@id='epigraph']}{xml:epigraph} \xmlsetsetup{#1}{[@class='hidden']/h1}{} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:div \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:h1 \section{\xmlflush{#1}} \stopxmlsetups \xmlprocessbuffer{main}{demo}{} \stoptext ConTeXt MkIV is not able to understand class=section level1 hidden as class=section class=level1 class=hidden and the second attribution is invalid XML (according to the W3C Validator [http://validator.w3.org/] and xmlvalidation.com): class should be only specified once. I think this might be a bug in ConTeXt. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Problem with luacode
On 1/20/2015 8:03 PM, Eric Gerard wrote: Hello Hans, sorry for that, here is the code I used to check some LUACODE. \definepapersize[normal][width=14.85cm, height=21cm] \setupbodyfont[10pt] \enableregime[il1] \setupcolor[xwi] \setuplayout[backspace=16mm, leftmargin=15mm,leftmargindistance=1mm,topspace=10mm,header=0mm,footer=0mm,height=200mm,rightmargin=0mm,width=131mm,location=middle,marking=on] \setuppapersize[normal][A4] \definelayer[OngletGauche][x=0mm, y=0mm, width=\paperwidth, height=\paperheight] \setupTABLE[r][1][color=dodgerblue,align={middle,lohi},height=1cm,style={\sansserif \bfx},framecolor=black] % variables \newdimen\hauteuronglet %height of tab \hauteuronglet=1cm %variables onglet bas \newdimen\largeurzoneongletsbas% total width available for tabs \newdimen\ordonneeongletsbas% vertical position of tab \newdimen\abscisseongletsbas% horizontal position of tab \newdimen\largeurongletbas % tab width \startluacode function test(opt_1, arg_1) local table = lpeg.split(,,interfaces.tolist(opt_1)) local labels = lpeg.split(,,arg_1) local NumLigne = table[1] local NbTotalOnglets = table[2] local PremierOnglet = table[3] local decalage = tex.sp(6.5pt) print(NumLigne) print(NbTotalOnglets) print(PremierOnglet) tex.dimen.ordonneeongletsbas = tex.dimen.paperheight - tex.dimen.hauteuronglet * NumLigne tex.dimen.largeurzoneongletsbas = tex.dimen.paperwidth - tex.dimen.backspace tex.dimen.largeurongletbas = tex.dimen.largeurzoneongletsbas / NbTotalOnglets tex.dimen.abscisseongletsbas = tex.dimen.backspace + tex.dimen.largeurongletbas * (PremierOnglet - 1) local x_ongletsbas = tex.dimen.abscisseongletsbas - decalage local y_ongletsbas = tex.dimen.ordonneeongletsbas local largeurongletbas = tex.dimen.largeurongletbas context.setupbackgrounds({page},{background = OngletBas,OngletGauche,ACouper}) context.setlayer({OngletBas},{hoffset = x_ongletsbas, voffset = y_ongletsbas}, context.setupTABLE({c},{1,2,3,4,5,6},{width = largeurongletbas}) context.bTABLE() context.bTR() context.bTD() context(labels[1]) context.eTD() context.eTR() context.eTABLE() ) end interfaces.definecommand { name = test, arguments = { { option, hash }, { content, string }, }, macro = test, } \stopluacode \starttext \ss \showframe \input{tufte} \test[1,6,1]{GROUND EGRESS} \stoptext This code is not working, I get an error while calling the function, and I don’t understand why. \definepapersize [normal] [width=14.85cm, height=21cm] \setupbodyfont [10pt,ss] \setupcolor [xwi] \setuppapersize [normal][A4] \setuplayout [backspace=16mm, leftmargin=15mm, leftmargindistance=1mm, topspace=10mm, header=0mm, footer=0mm, height=200mm, rightmargin=0mm, width=131mm, location=middle, marking=on] \definelayer [OngletGauche] [x=0mm, y=0mm, width=\paperwidth, height=\paperheight] \definelayer [OngletBas] [x=0mm, y=0mm, width=\paperwidth, height=\paperheight] \setupTABLE [r][1] [color=dodgerblue, align={middle,lohi}, height=1cm, style=\bfx, framecolor=black] % variables \startluacode local decalage = string.todimen(6.5pt) local hauteuronglet = string.todimen(1cm) function test(opt_1,arg_1) local options = utilities.parsers.settings_to_array(opt_1) local labels = utilities.parsers.settings_to_array(arg_1) local NumLigne = options[1] local NbTotalOnglets = options[2] local PremierOnglet = options[3] local ordonneeongletsbas= tex.dimen.paperheight - hauteuronglet * NumLigne local largeurzoneongletsbas = tex.dimen.paperwidth - tex.dimen.backspace local largeurongletbas = largeurzoneongletsbas / NbTotalOnglets local abscisseongletsbas= tex.dimen.backspace + largeurongletbas * (PremierOnglet - 1) local x_ongletsbas = abscisseongletsbas - decalage local y_ongletsbas = ordonneeongletsbas context.setupbackgrounds({page},{background = OngletBas,OngletGauche,ACouper}) context.setlayer( {
Re: [NTG-context] bug when dealing with XML classes?
On 1/22/2015 7:42 PM, Pablo Rodriguez wrote: Hans, I have the following sample: \setupbodyfont[30pt] \startbuffer[demo] doc h1This is my title/h1 div class=section class=level1 class=hidden h1This title is hidden/h1 /div div class=section level1 hidden h1This title is not hidden/h1 pText/p /div /doc \stopbuffer \starttext \startxmlsetups xml:initialize \xmlsetsetup{#1}{div}{xml:div} \xmlsetsetup{#1}{h1}{xml:h1} \xmlsetsetup{\xmldocument}{[@id='epigraph']}{xml:epigraph} \xmlsetsetup{#1}{[@class='hidden']/h1}{} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:div \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:h1 \section{\xmlflush{#1}} \stopxmlsetups \xmlprocessbuffer{main}{demo}{} \stoptext ConTeXt MkIV is not able to understand class=section level1 hidden as class=section class=level1 class=hidden It has nothing to do with understanding: successive attributes with the same name will overload a previous one. You can try this: \xmlsetsetup{#1}{[contains(@class,'hidden')]/h1}{} and the second attribution is invalid XML (according to the W3C Validator [http://validator.w3.org/] and xmlvalidation.com): class should be only specified once. it says: the markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc. I think this might be a bug in ConTeXt. we parse xml, and not html (some evolving dialect) ... in fact i think that the last class will win so that boils down to using only one Many thanks for your help, Pablo -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] linking to html etc. documents from pdf.
On Thu, 22 Jan 2015, John Culleton wrote: DTP programs like Inkscape and Scribus have facilities for linking to urls. Pdftex does also. If this facility exists in Context can some kind soul point me to the documentation? You mean useURL? http://wiki.contextgarden.net/Command/useURL Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] linking to html etc. documents from pdf.
DTP programs like Inkscape and Scribus have facilities for linking to urls. Pdftex does also. If this facility exists in Context can some kind soul point me to the documentation? Thanks in advance. -- John Culleton Wexford Press Free list of books for self-publishers: http://wexfordpress.net/shortlist.html Updated PDF e-book: Create Book Covers with Scribus 1.4.5 coming soon at http://www.booklocker.com/! ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] linking to html etc. documents from pdf.
On 1/22/2015 9:34 PM, John Culleton wrote: DTP programs like Inkscape and Scribus have facilities for linking to urls. Pdftex does also. If this facility exists in Context can some kind soul point me to the documentation? One of the oldest features of context \setupinteraction[state=start] \starttext \goto{whatever}[url(http://www.pragma-ade.nl)] \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Formatting bibliographic inline references and publications list
From what I can see, the only *significant* style difference that you seek is the use of \letterspace and \sc for names (authors or editors). The use of old numbers is trivial as they will be used if specified for the rest of the document. How else does your university's standard differ from the APA? All of the details of the layout are programmable using setups. By the way, the APA sort order is: authors(or editors), year, title (and possibly journal, volume, number, page). Alan On Mon, 19 Jan 2015 19:44:56 +0100 Hans Hagen pra...@wxs.nl wrote: On 1/17/2015 7:23 AM, Jörg Weger wrote: Hi Alan What I am trying to achieve is the following (of which typesetting the author’s name is only a detail): setting up an environment that I can use for all papers and works that I have to write during my academic studies. With the basic layout I am almost done. The main remaining problem is to get the bibliographic information details in the publications list into the right order for every possible type of publication according to the standards demanded by my university department which differ from APA style. You ask what I am looking for: It would be great to be able at the same time to format every detail of information while defining said order. Defining that order could be done by giving a kind of “maximum case” with the exact order of the desired variables and the punctuation and blanks between them for every particular type of publication cited. Out of that “maximum case” the underlying mechanism would ignore everything not needed in the particular case of a certain publication. In the case of publication type “book” it could be something like: \setpublicationstyleforlist [type:book] [{invertedauthor1}{/}{invertedauthor2}{/}{invertedauthor3}{et al.}{ (}{year}{): }{title}{. }{address}{: }{publisher}{.}] ... that not good enough: fields can be absent, there is no way to distinguish authors from titles and so ... the new mechanism we're making tries to cover a lot of aspects and it's not that trivial to also keep the interface simple then anyway, what we're talking of (currently) is: - datasets, where data comes from bib files, lua tables xml files or whatever gets interfaced - optional typing, which means that one can tell what fields represents what kind of data - fallback sets i.e a sequence that will be checked when a field is requested - virtual fields (think of numbers and author year combinations) - control via settings (the et-al thing as well as fences and punctuation) - rendering driven by setups so that users have full control (if they want) over what comes out - a bunch of helper macros (checking, spacing etc) - a collection of methods that can be applied to fields when they are called up - calling up citations by tag but also by a query - control over lists - automatic generation of registers - passing along extra data entered in the source - and more we don't know how many users will define renderings themselves but in principle it should not be too hard to copy existing setups and mess with them there is quite some tracing available because it can go wrong in many places (depending on the quality of the data) attached are two simple examples of how users can define things Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - -- Alan Braslau CEA DSM-IRAMIS-SPEC CNRS URA 2464 Orme des Merisiers 91191 Gif-sur-Yvette cedex FRANCE tel: +33 1 69 08 73 15 fax: +33 1 69 08 87 86 mailto:alan.bras...@cea.fr ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] bug when dealing with XML classes?
On 01/22/2015 07:57 PM, Hans Hagen wrote: On 1/22/2015 7:42 PM, Pablo Rodriguez wrote: [...] ConTeXt MkIV is not able to understand class=section level1 hidden as class=section class=level1 class=hidden It has nothing to do with understanding: successive attributes with the same name will overload a previous one. You can try this: \xmlsetsetup{#1}{[contains(@class,'hidden')]/h1}{} Many thanks for your fast reply, Hans. I was totally wrong. It was my understanding the one that was buggy :-). Many thanks for your help again, 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] layers for odd and even pages
On 01/20/2015 11:39 PM, Wolfgang Schuster wrote: Am 20.01.2015 um 20:14 schrieb Pablo Rodriguez: [...] I need different layers in even and odd pages and that they are hidden on empty pages. Which is the way to do it? Not sure if this is the best way but it works. Many thanks for your reply, Wolfgang. This is what I was looking for. Many thanks for your help, Pablo \setuppapersize[A5] \setuppagenumbering[alternative=doublesided,location=] \definelayer[test][state=repeat,doublesided=yes] \setlayer[test][right]{Odd page} \setlayer[test][left] {Even page} \setupbackgrounds[page][background=test] \starttext \dorecurse{5} {\dorecurse{\recurselevel}{\input zapf\par} \page \pushbackground[page] \setupbackgrounds[page][background=] \page[right] \popbackground} \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Page Breaks after Headings
On 01/20/2015 11:41 PM, Malte Stien wrote: Hi all, Is there a way I can avoid page breaks after “headings”, i.e. \section, \subsection, \subject, \subsubject, etc? Hi Malte, since I experienced this before and Wolfgang kindly explained to me, the workaround is: \setuphead[section][after={\blank[samepage]}] Only defining after for section (I think it) should work for other headings. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___