Re: [NTG-context] CSV scanners built in ConTeXt - feature or bug?
Hans and Alan, Thanks for the reply. Now it works properly. I would like to ask if you're planning to fix file util-prs.lua in a future release of standalone ConTeXt. As for me, I'd rather vote for as the default option other option, ie which does not stop on a blank line ie. not how it's setup now (ie personally I'd rather vote strict=true would mean process all lines of CSV file and strict=false mean stop processing on blank line), but I will take into account whatever alternative and consequently I would take into account this options for my own library. Alan writes about this behavior as like metapost feature. Personally, I think that the CSV file is basically a plain text file and a blank line in it has its place. The end of the text file is usually marked by eof character, so I guess there's no reason to terminate processing before the file really ends. Jaroslav Hajtmar Dne 26.2.2015 v 12:20 Alan BRASLAU napsal(a): On Thu, 26 Feb 2015 10:47:29 +0100 Hans Hagen pra...@wxs.nl wrote: i'm not sure about the default as the standard might demand quit at empty line so that needs to be figured out (not by me therefore by you) Stop on empty line is a very MetaPost-like feature. I don't have an opinion as to what should be expected for CSV, but MP thus allows one to pick-off sets of data by successive reads to one file. Alan ___ 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 ___ ___ 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] total pages in external PDF
On 02/25/2015 10:45 PM, Hans Hagen wrote: On 2/25/2015 6:41 PM, Pablo Rodriguez wrote: [...] \def\Myfilename{\env{filename}} doc = epdf.open(arg[\MyFilename]) total_pages_ = doc:getNumPages() \def\Mypages{total_pages} [...] Which is the right way to get the code above working? \getfiguredimensions[whatever.pdf] \noffigurepages Many thanks for your reply, Hans. It works like charm. Now I can generate my booklets fully automatic (for the people :-)). Many thanks again 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] total pages in external PDF
On 02/25/2015 11:05 PM, Aditya Mahajan wrote: On Wed, 25 Feb 2015, Pablo Rodriguez wrote: I need to get the number of pages from an external PDF file that I also define with an \env. [...] From my old cut-n-paste module (to format two column pdfs into one column so that they are easier to read on an eink reader) \useexternalfigure[cnp:name][\cut!n!paste!parameter\c!name]% Is this really needed? \getfiguredimensions[cnp:name]% \edef\cut!n!paste!NOfpages {\noffigurepages}% Many thanks for your reply, Aditya. 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 ___
[NTG-context] textbackground
Hello, For a multilingual document, alternating one language or another, not necessarily a bilingual, translated text, I thought about using textbackground to set-off paragraphs. This technique could also apply to a single language text having multiple levels of information, perhaps statements followed by discussion, etc. A problem appears with respect to footnotes that I do not know how to handle. If the backgrounded text goes across pages placing footnotes, then the footnote also gets the background. This is incorrect, perhaps a bug. Second problem, if a footnote of a backgrounded text gets placed on a following page, then it may not get a background. (It is not clear to me whether it would be correct for footnotes to get the background or not.) Of course, a solution to this secondary problem might be before={\startlocalfootnotes}, after={\placelocalfootnotes\stoplocalfootnotes}, although such a solution would postpone backgrounded footnotes to the end of the backgrounded text. Alan MWE: \definetextbackground [spanish] [location=paragraph, frame=off, before={\language[es]}, background=color, backgroundcolor=lightgray] \starttext \input darwin% \startfootnote \input dawkins \stopfootnote \input tufte \startspanish \input quevedo-es% \startfootnote \input cervantes-es \stopfootnote \stopspanish \input zapf \stoptext ___ 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] textbackground
On 2/26/2015 10:22 AM, Alan BRASLAU wrote: Hello, For a multilingual document, alternating one language or another, not necessarily a bilingual, translated text, I thought about using textbackground to set-off paragraphs. This technique could also apply to a single language text having multiple levels of information, perhaps statements followed by discussion, etc. A problem appears with respect to footnotes that I do not know how to handle. If the backgrounded text goes across pages placing footnotes, then the footnote also gets the background. This is incorrect, perhaps a bug. Second problem, if a footnote of a backgrounded text gets placed on a following page, then it may not get a background. (It is not clear to me whether it would be correct for footnotes to get the background or not.) Of course, a solution to this secondary problem might be before={\startlocalfootnotes}, after={\placelocalfootnotes\stoplocalfootnotes}, although such a solution would postpone backgrounded footnotes to the end of the backgrounded text. Alan MWE: \definetextbackground [spanish] [location=paragraph, frame=off, before={\language[es]}, background=color, backgroundcolor=lightgray] \starttext \input darwin% \startfootnote \input dawkins \stopfootnote \input tufte \startspanish \input quevedo-es% \startfootnote \input cervantes-es \stopfootnote \stopspanish \input zapf \stoptext \definetextbackground[en] \definetextbackground[nl] \setnewconstant\kindofpagetextareas 1 % low level, no high level switch (yet) \starttext \starttextbackground[en] \dorecurse{10}{\input tufte \footnote{tufte} \par} \stoptextbackground \starttextbackground[nl] \dorecurse{10}{\input tufte \footnote{tufte} \par} \stoptextbackground \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] CSV scanners built in ConTeXt - feature or bug?
On 2/26/2015 1:40 AM, Jaroslav Hajtmar wrote: \starttext \startluacode local mycsvsplitter = utilities.parsers.rfc4180splitter{ separator = ,, quote = '', } local crap = io.loaddata(data.txt) -- with header variant local tablerows, columnname = mycsvsplitter(crap,true) inspect(tablerows) inspect(columnname) -- without header variant -- local tablerows = mycsvsplitter(crap) -- inspect(tablerows) for i=1,#tablerows do local l = tablerows[i] for j=1,#l do context(l[j].., ) end context('\\crlf') end \stopluacode \stoptext line 527 in util-prs.lua: local wholeblob = Ct((newline^(specification.strict and -1 or 1) * record)^0) should do the trick i'm not sure about the default as the standard might demand quit at empty line so that needs to be figured out (not by me therefore by you) \starttext \startluacode local crap = [[ 1,2,3,4 a,b,c,d foo,barbaz,boogie,xyzzy ,,, And now,followed by,several,blank lines 1,2,3,4 a,b,c,d foo,barbaz,boogie,xyzzy ,,, ]] local mycsvsplitter = { utilities.parsers.rfc4180splitter{ separator = ,, quote = '', strict = true, }, utilities.parsers.rfc4180splitter{ separator = ,, quote = '', } } for i=1,#mycsvsplitter do local tablerows, columnname = mycsvsplitter[i](crap,true) context.formatted.title(Case %s,i) for i=1,#tablerows do local l = tablerows[i] for j=1,#l do context(l[j].., ) end context('\\crlf') end end \stopluacode \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] CSV scanners built in ConTeXt - feature or bug?
On Thu, 26 Feb 2015 10:47:29 +0100 Hans Hagen pra...@wxs.nl wrote: i'm not sure about the default as the standard might demand quit at empty line so that needs to be figured out (not by me therefore by you) Stop on empty line is a very MetaPost-like feature. I don't have an opinion as to what should be expected for CSV, but MP thus allows one to pick-off sets of data by successive reads to one file. Alan ___ 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] Error when using TikZ with the library datavisualization
Hello The following code gives an error (current beta and version from texlive 2014): \usemodule[tikz] \usetikzlibrary[datavisualization] \starttext A \stoptext The log gives the following error: tex error error on line 682 in file /usr/local/texlive/2014/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex: ! Missing number, treated as zero to be read again ^ l.682 {\catcode`\^^ M=\active% 672 \def\pgf@temp{#1}% 673 \ifx\pgf@temp\tikz@lib@dv@auto@attribute% 674 \tikzdatavisualizationset{\tikz@dv@axis/label/.expanded=$\noexpand\mathit{\pgfkeysvalueof{\tikz@dv@axis/attribute}}$}% 675 \else 676 \tikzdatavisualizationset{\tikz@dv@axis/label={#1}}% 677 \fi 678 }, 679 label/.default=\tikz@lib@dv@auto@attribute, 680 % 681 % Strategies 682 % 683 tick placement strategy/.style={\tikz@dv@axis/@compute at positions={#1}}, 684 linear steps/.style={tick placement strategy=\tikz@lib@dv@compute@at@linear}, 685 % 686 % Attribute setter 687 % 688 goto/.code={\tikz@dv@goto{\tikz@dv@axis}{#1}}, 689 goto pos/.code={\tikz@dv@goto@pos{\tikz@dv@axis}{#1}}, 690 anchor at min/.code={\tikz@lib@dv@special@at{\tikz@dv@axis}{\tikz@dv@min@anchor}}, 691 anchor at max/.code={\tikz@lib@dv@special@at{\tikz@dv@axis}{\tikz@dv@max@anchor}}, 692 %___ 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] Error when using TikZ with the library datavisualization
On 2/27/2015 1:06 AM, Alias 1 wrote: Hello The following code gives an error (current beta and version from texlive 2014): \usemodule[tikz] \usetikzlibrary[datavisualization] how is \usetikzlibrary defined? it should load the file in unprotected mode (\between \unprotect .. \protect) as hack you can probably do \unprotected \usetikzlibrary[datavisualization] \starttext A \stoptext The log gives the following error: tex errorerror on line 682 in file /usr/local/texlive/2014/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex: ! Missing number, treated as zero to be read again ^ l.682 {\catcode`\^^ M=\active% 672 \def\pgf@temp{#1}% 673 \ifx\pgf@temp\tikz@lib@dv@auto@attribute% 674 \tikzdatavisualizationset{\tikz@dv@axis/label/.expanded=$\noexpand\mathit{\pgfkeysvalueof{\tikz@dv@axis/attribute}}$}% 675 \else 676 \tikzdatavisualizationset{\tikz@dv@axis/label={#1}}% 677 \fi 678 }, 679 label/.default=\tikz@lib@dv@auto@attribute, 680 % 681 % Strategies 682 % 683 tick placement strategy/.style={\tikz@dv@axis/@compute at positions={#1}}, 684 linear steps/.style={tick placement strategy=\tikz@lib@dv@compute@at@linear}, 685 % 686 % Attribute setter 687 % 688 goto/.code={\tikz@dv@goto{\tikz@dv@axis}{#1}}, 689 goto pos/.code={\tikz@dv@goto@pos{\tikz@dv@axis}{#1}}, 690 anchor at min/.code={\tikz@lib@dv@special@at{\tikz@dv@axis}{\tikz@dv@min@anchor}}, 691 anchor at max/.code={\tikz@lib@dv@special@at{\tikz@dv@axis}{\tikz@dv@max@anchor}}, 692 % ___ 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 ___ -- - 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 ___