Re: [NTG-context] Change color of EPS file.
2012/9/15 Troy Henderson thend...@gmail.com: Utilities are available in abundance which can transform raster graphics from color to grayscale, but until I created this yesterday, I have never seen a utility that keeps the graphic in vector format (i.e., never rasterizes it throughout the conversion) and converts it from color to grayscale. Until I read this thread, I guess I thought I was the only one that desired such a tool. I'm glad to see that at least I'm not alone. Oh, there are, but I know only commercial (e.g. OneVision Asura) or in-house solutions (like what I managed at a newspaper several years ago). The simple (or simplistic) rgbcolor patch doesn't work with complicated EPS, of course. But then you'd need to know the structure of your EPS. It's hard to get that right for arbitrary EPS. And there aren't that many able PostScript programmers left. E.g. at that newspaper we were able to switch spot colors just before plate exposition; the trick was to use a generic spot color name throughout the workflow and to change its definition in the completed page EPS. (At that time our printing press was too small to print all pages in full color.) Since PostScript is a full programming language, most PS generators use shortcuts (macros/functions) that wrap the originally simple commands, so you often can't track down where the structure hides that you'd like to change. Best solution is often to do a full expansion with a PS interpreter and write a new, better readable, but mostly much bigger code. pstoedit is your friend for that – e.g. Hans did some nice tricks with EPS pictures converted to MetaPost. I once experimented a bit with changing colors of embedded bitmap images – it's rather easy to do, but never looks right without a deep understanding of color management and its strange implementation in PostScript... Greetlings, Hraban ___ 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] \everymath
Am 16.09.2012 um 01:32 schrieb Rogers, Michael K mrog...@emory.edu: I often want every math mode (between single $) be \displaystyle. In Plain TeX, you do something like \everymath={\displaystyle} Is the best ConTeXt way to do something like this? \appendtoks\displaystyle\to\everymathematics Or is there a key in \setupmathematics? I don’t think so because I found only the command below the change the appearance of inline formulas and \displaymath/\displaymathematics isn’t what you want because it creates a display formula. \let\normalstopdmath\Ustopdisplaymath % to prevent error message from \displaymath \starttext \mathematics {\frac{1}{2}} \displaymathematics{\frac{1}{2}} \inlinemathematics {\frac{1}{2}} \displaymath{\frac{1}{2}} \inlinemath {\frac{1}{2}} \textmath {\frac{1}{2}} \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 ___
Re: [NTG-context] MKII MKIV difference between \textrule
On 14-9-2012 13:26, Wolfgang Schuster wrote: Am 14.09.2012 um 00:08 schrieb Alessandro Perucchi alessan...@perucchi.org: Hello, In my experimentation, I've found that in mkii and mkiv the behavior of \textrule and \setuptextrule are different... What I did was quite simple: \textrule{Testing head} blah blah blah \textrule in mkii the text in well centered between the lines. But in mkiv the bottom line is too near the text, and I need to add something like \blank[halfline] to have a similar behavior as mkii. There is a vertical skip missing in the MkIV version of the macros. pack-mrl.mkiv \def\pack_textrule_following#1% {\doifelsenothing{#1} -{\nointerlineskip + {\vskip\dimexpr\strutdp+.5ex\ifdim\prevdepth\strutdp\else\ifdim\prevdepth\zeropoint-\prevdepth\fi\fi\relax + \nointerlineskip \dontleavehmode\vbox {\color[\directtextrulesparameter\c!rulecolor] {\hrule\s!depth\directtextrulesparameter\c!rulethickness\s!height\zeropoint\s!width\availablehsize}}} {\pack_textrule_with_text{#1}}% \ifvmode \prevdepth\zeropoint \fi} actually that's the commented code ... \pack_textrule_correct_depth ... i'm still not that convinced if that correction always looks right (i've reenabled it but it might become an option) And apparently the command \starttextrule ... \stoptextrule doesn't work (this was explain in the cont-entp.pdf page 204) in either mkii mliv. This does work for me: \starttext blah blah blah \starttextrule{Testing head} blah blah blah \stoptextrule blah blah blah \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 ___ -- - 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] Strange bug with reversed itemize
On 15-9-2012 20:06, Aditya Mahajan wrote: On Sat, 15 Sep 2012, Wolfgang Schuster wrote: Am 15.09.2012 um 00:06 schrieb Aditya Mahajan adit...@umich.edu: Thanks for the diagnosis. What will be a good way to fix this? I think that \expanded{\setupcounter[#1][\c!start=\ifx\p_start\empty0\else\number\p_start\fi.,...]} should work (but I haven't tested it yet). I would do the expansion here but with \normalexpanded. \def\strc_counter_setup_using_parameter#1#2% name \someparameter {\edef\p_start{#2\c!start}% %\setupcounter \normalexpanded{\setupcounter [#1] [ \c!start=\ifx\p_start\empty0\else\number\p_start\fi, \c!state=#2\c!state, % beware, == start \c!way=#2\c!way, % \c!prefix=#2\c!prefix, \c!prefixseparatorset=#2\c!prefixseparatorset, \c!prefixconversion=#2\c!prefixconversion, \c!prefixconversionset=#2\c!prefixconversionset, \c!prefixstarter=#2\c!prefixstarter, \c!prefixstopper=#2\c!prefixstopper, \c!prefixset=#2\c!prefixset, \c!prefixsegments=#2\c!prefixsegments, \c!prefixset=#2\c!prefixset, \c!prefixconnector=#2\c!prefixconnector, % \c!numberseparatorset=#2\c!numberseparatorset, \c!numberconversion=#2\c!numberconversion, \c!numberconversionset=#2\c!numberconversionset, \c!numberstarter=#2\c!numberstarter, \c!numberstopper=#2\c!numberstopper, %\c!numbersegments=#2\c!numbersegments]} \c!numbersegments=#2\c!numbersegments]}} Thanks. Hans, can you add this to strc-num.mkiv? Sure, as I assume that Wolfgang investigated possible side effects. 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 - ___ 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] Referring to multiple elements
2012-09-14 Sietse Brouwer sbbrou...@gmail.com: Hi Sietse, I'm sorry for my late reply. The heart of what you need is a lua function that will take an array of numbers, and return an array of consective-number runs, like so: […] I've written one below, plus the scaffolding required to feed it the right input, and print its output to ConTeXt. I wonder if this function is not already present in ConTeXt. The register mechanism, for instance, already does something very similar: \setupregister [index] [compress=yes] \starttext A\index{A} \page A\index{A} \page aaa\page bbb\page A\index{A} \page A\index{A} \page A\index{A} \placeindex %% = A 1-2, 5-7 \stoptext Only two functions still need writing --- one to turn the context argument [fig:f1, fig:f2, fig:f4] into a lua array of strings, and one to turn each reference string into a figure number. I'm quite sure that all the building blocks are already present. I'm not sure about the case when the float number is preceded by a chapter number. If you're not comfortable with programming LuaTeX, say so and I can fill in the two missing functions sometime this weekend. But they should be doable, really. Someone with more expertise and knowledge about the ConTeXt internals should be able to point to the relevant functions. I guess the code that produces the index compression is located in registers.flush() in strc-reg.lua, but apparently it's not a function and I don't know if it can be adopted for the float referencing. (And, of course, you may be far more experienced in LuaTeX than I, I don't know.) Probably not. I can read and write simple Lua scripts, but I lack knowledge about the LuaTeX and ConTeXt internals and the data structures used. For LuaTeX there is a manual that explains a lot, but it doesn't help figuring out how ConTeXts float referencing mechanism works. Thanks for the work you spend on this. I don't need this function for the current project (I use the workaround), but I would like to see this feature in ConTeXt. If you have time and expertise to implement this, it would be great. Otherwise I'll do the range referencing manually. Regards Marco ___ 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] [.tuc] oddity when storing a table
Hi all, I can’t explain the following behavior of the .tuc writer. When passed a nested hash, context fails on the second pass if the array part of the first nesting depth is empty: ··· %% the commented lines work \startluacode job.variables.tobesaved.foo = { bar = { } } -- job.variables.tobesaved.foo = { works now, bar = { } } -- job.variables.tobesaved.foo = { bar = works too } \stopluacode \starttext foo \stoptext ··· I get this error: ··· ! LuaTeX error ...text/tex/texmf-context/tex/context/base/cldf-ini.lua:410: no string to print stack traceback: [C]: in function 'flush' ...text/tex/texmf-context/tex/context/base/cldf-ini.lua:410: in function ...text/tex/texmf-context/tex/context/base/cldf-ini.lua:360 (tail call): ? ...text/tex/texmf-context/tex/context/base/core-uti.lua:112: in function 'initializer' ...text/tex/texmf-context/tex/context/base/core-uti.lua:200: in function 'load' ...text/tex/texmf-context/tex/context/base/core-uti.lua:66: in function 'initialize' main ctx instance:1: in main chunk. system tex error on line 1 in file /home/phg/context/tex/texmf-context/tex/context/base/cont-yes.mkiv: LuaTeX error ... ··· Bug? Regards Philipp pgpU2Xa6DgoT6.pgp Description: PGP signature ___ 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] [.tuc] oddity when storing a table
On 16-9-2012 19:17, Philipp Gesang wrote: Hi all, I can’t explain the following behavior of the .tuc writer. When passed a nested hash, context fails on the second pass if the array part of the first nesting depth is empty: ··· %% the commented lines work \startluacode job.variables.tobesaved.foo = { bar = { } } -- job.variables.tobesaved.foo = { works now, bar = { } } -- job.variables.tobesaved.foo = { bar = works too } \stopluacode \starttext foo \stoptext ··· I get this error: ··· ! LuaTeX error ...text/tex/texmf-context/tex/context/base/cldf-ini.lua:410: no string to print stack traceback: [C]: in function 'flush' ...text/tex/texmf-context/tex/context/base/cldf-ini.lua:410: in function ...text/tex/texmf-context/tex/context/base/cldf-ini.lua:360 (tail call): ? ...text/tex/texmf-context/tex/context/base/core-uti.lua:112: in function 'initializer' ...text/tex/texmf-context/tex/context/base/core-uti.lua:200: in function 'load' ...text/tex/texmf-context/tex/context/base/core-uti.lua:66: in function 'initialize' main ctx instance:1: in main chunk. system tex error on line 1 in file /home/phg/context/tex/texmf-context/tex/context/base/cont-yes.mkiv: LuaTeX error ... ··· Bug? no, feature. job variables are just key/values and accessible at the tex end (you store 'works too' in 'bar') if you want arbitrary data to be stores you need to used datasets, as explained in http://wiki.contextgarden.net/Command/definedataset - 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 ___