Re: [NTG-context] Multi-page textbackground ignores topoffset
Nicholas, > Is there any way to get a multi-page textbackground to respect > topoffset on each page? From the second page onwards, > it leaves no offset at the top. I have the same problem. A small-not-so-good-hack would be to define a tiny backgroundoffset as well. This messes the layout a little... but you might think it is better then having no offset at all... André Caldas. ___ 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] Node for startbuffer.
> It's somewhat experimental. Up to you to update the wiki. Anyone can suggest a category for it? http://wiki.contextgarden.net/Category:Commands Nodes? André Caldas. ___ 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] Node for startbuffer.
> I've added the markers code to the beta so that we have an > abstract way to deal with such matters. > [...] > Node lists are processed \hbox \boxmarker{mymarker}{1} {nested from > [...] Does it have to be an "hbox"? > > It's somewhat experimental. Up to you to update the wiki. I've never updated the wiki... I am a bit scared... but I will... :-) > I've added the example to the cld manual. How can I see it? André Caldas. ___ 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] Metapost nodes.
Hello! 1. How does a metapost figure (\startMPcode) becomes a node? 2. When does it become a node? 3. What type of node it becomes? 4. Can I change its attributes? 5. Can I change its colors or transparency levels? André Caldas. ___ 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] Node for startbuffer.
>> How do I identify a specific node? Like... >> [...] > > Here is a start. I've added the markers code to the beta so that we > have an abstract way to deal with such matters. > [...] > \hbox \boxmarker{mymarker}{2} Can't the mark be a string? André Caldas. ___ 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] Installing beta.
What is the correct way to install the beta version of context? André Caldas. ___ 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] Node for startbuffer.
Another question... > function userdata.processmystuff(head) Shall I use this? userdata = userdata or {} > \startbuffer > whatever \hbox{you} want > \stopbuffer How do I identify a specific node? Like... \startbuffer Will this be \boxtobechanged{transparent?} \stopbuffer André Caldas. ___ 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] Node for startbuffer.
> here's an example (I'll add it to the cld manual): Wow!!! Thank you for your time, Hans! I will study your sample... :-) Cheers, André Caldas. ___ 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] Node for startbuffer.
Hello! Given some \startbuffer Blah, blah, blah... \stopbuffer I'd like to get a "node tree" corresponding to how the buffer would be processed at a given point. Using luatex, I'd like to identify certain sub-nodes and change their attributes (to be specific: transparency). Any hint on how to do it? Also, are there any good examples on how to use "nodes"? André Caldas. ___ 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] Multi-page frame.
Hello! How can I have a "framed text" that can cross page boundaries? Cheers, André Caldas. ___ 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] Numerical Calculations
> Here's the animated (video) version. > > http://www.youtube.com/watch?v=2_OZ-yKMd7g How did you produce a video out of the PDF? ___ 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] Balanced parenthesis.
Instead of writing $\left( x+y \right)$, I'd like to simply write $(x + y)$. For unmatched parenthesis, I would like to write $:-\unmatched)$. How can I accomplish that in context? Cheeers, André Caldas. ___ 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] Transparency without colors.
>> How can I define the transparency of some text? > > http://wiki.contextgarden.net/Color I want to set up the transparency without messing with the colors (that were setup by the user). André Caldas. ___ 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] Module for Commutative Diagrams.
Hello! Some days ago, I have written a module for writing "commutative diagrams" using MetaPost. Definition of "commutative diagrams": https://duckduckgo.com/?q=commutative+diagrams The module lives here, now: https://bitbucket.org/andrecaldas/context-commutativediagrams The module still needs a lot of working... but for very, very simple diagrams, it works! At least for me... =o) Comments are very welcome, André Caldas. PS: I have to submit the final version of my doctoral thesis just before the end of the world (20/12/2012). For that reason I have not worked on the simplesteps module... but I'd like to thank all the support given in my last thread. ___ 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] Regular expressions in Lua.
Hi! > As ranges are sometimes handy I've added a parser to the core Nice. I will use it as soon as it is available. It is a very good thing that range specifications will be uniform across different modules. André Caldas. ___ 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] New module: simplesteps.
> %% begin example > \grabbufferdata[mybuffer][thisisthestart][thisistheend] > \thisisthestart > My friend, you would not tell with such high zest > To children ardent for some desparate glory, > The old Lie: Dulce et decorum est > Pro patria mori. > \thisistheend > > \typebuffer[mybuffer] > %% end example > > What am I doing wrong? And is the description I put on the wiki correct? It's just a guess... but I think the \grabbufferdata has to be invoked *after* the \thisisthestart, \thisistheend pair. André Caldas. ___ 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] Regular expressions in Lua.
Hello, Hans! I had just managed to do it. I will switch to yours instead of mine... I don't have any experience in Lua. Sorry for bothering with such easy requests... By the way, simplesteps recognizes number ranges! :-) https://bitbucket.org/andrecaldas/context-simplesteps/src/1c7ced45208b78289590008760daa3bac05ec503/mod/tex/context/third/simplesteps/simplesteps.lua?at=default#cl-37 Thank you, André Caldas. ___ 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] Regular expressions in Lua.
Hi! I have to use pattern matching in lua. I tried the function "string.gmatch". I want to match (iterate over) strings of the type ([0-9]+)(-([0-9]*))?(,|$) For example: 1,3- (iterations: 1 and 3-) 1-3,6,7 (iterations: 1-3 then 6 then 7) 1-2,5-6,10- (iterations 1-2 then 5-6 then 10-) André Caldas. ___ 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] New module: simplesteps.
> thanks for the interesting contribution! Have a look at the patch > I hopefully don’t forget to append. I didn't quite understood how this works: \unexpanded\def\startframe{\dosingleempty\frame_start} \def\frame_start[#1]{% \iffirstargument \section{#1}%% solution needed here! \fi \begingroup \grabbufferdata[simplesteps][startframe][stopframe]% } \let\stopframe\simplestepsplaybuffer Cheers, André Caldas. ___ 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] New module: simplesteps.
Hello, OK! > You were so quick to write your module… > Thanks for sharing, :-) > but I could not typeset the example file you sent: > I didn't get whether your file simplesteps.mkiv should be renamed I did this on my machine: 1. Copy simplesteps.{lua,mkiv} to texmf-local/tex/context/third/simplesteps/ In my case, it is here: /home/andre/context_standalone/tex/texmf-local/tex/context/third/simplesteps 2. Clear the cache. I don't really know the proper way to do that. So, I just removed the directory texmf-cache. In my case: rm /home/andre/context_standalone/tex/texmf-cache/ -rf 3. Compile: context simpletest.tex > Maybe after you apply the changes suggested > by Wolfgang and Philip you are going to repost your moudle? The module will be here: https://bitbucket.org/andrecaldas/context-simplesteps Hopefully, one day, here... ;-) http://modules.contextgarden.net/ I will let you know. Cheers, André Caldas. ___ 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] New module: simplesteps.
> These expand to Lua long strings, [===[ and ]===] respectively, > without checking, so theoretically the same issue will arise iff > your string contains ]===]. I consider the likelihood for this to > happen to be too low to bother, but if you want to be absolutely > on the safe side you can also use \luaescapestring. See the > Luatex manual, section 2.3.6. The luaescapestring will also escape the quotation marks... :-) I will use it, then. I used to develop WEB systems. Very vulnerable to injection attacks. I really like things properly escaped... Cheers, André Caldas. ___ 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] New module: simplesteps.
> \unexpanded\def\uncover[#1]% > {\ctxlua{ > distance = simplesteps.distance_to_step(\!!bs#1\!!es) > ... > }} > > it works because the " is now only part of the string. Thanks. That's what I needed. I guess bs = begin string es = end string. Cheers, André Caldas. ___ 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] New module: simplesteps.
>> I have one question: >> - What does it happen when there is a quotation mark (") inside the >> parameter? Do I need to "escape" the contents passed to the macro? > > > No you don’t have to but you could have checked yourself :) Sorry... I didn't try it when I asked, but I had the impression I did try it before. In my case, if I use \uncover[2,"3]{} I get the error: =P ! LuaTeX error :1: ')' expected near '3'. system > tex > error on line 6 in file virtual://buffer.simplesteps.5: LuaTeX error ... \uncover ...t('\\simplestepscoveredveryfar') end } l.6 \uncover[2,"3] {\item The {\em second main message} of your talk in o... ? Cheers, André Caldas. ___ 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] New module: simplesteps.
>>> - maybe switch to mkvi as named parameters make rewriting >>>macros a breeze >> >> Would you elaborate a bit further? > > You can use for the parameter in your macros names instead of number, > as you can see below the first definition uses “#1” for the argument while > the second uses “#text”. > > You can force MkIV mode when you add “% macros=mkvi” at the top > of the file. When your code is a external file (e.g. a module) you can > give it “mkvi” as file extension (instead of the normal “tex” or “mkiv”) > and don’t need this line anymore. I had tried named parameters and I didn't know why it was not working... now I know! :-) I have one question: - What does it happen when there is a quotation mark (") inside the parameter? Do I need to "escape" the contents passed to the macro? André Caldas. ___ 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] New module: simplesteps.
Hello! > thanks for the interesting contribution! Have a look at the patch > I hopefully don’t forget to append. Thank you! I will take a look and learn... ;-) >> [...] >> I use \startbuffer and \stopbuffer, and also Lua. As I said, I don't >> really know how to write a module... comments are very welcome. > > Honestly, it doesn’t work, but that’s a minor flaw! Sorry! I forgot to mention. Only a little subset of it works. I have (already - so I don't forget to) attached a "tex" file that works. > [**lots of advices I will study carefully latter**] > [...] > I could not figure out how exactly the section block thingy is > supposed to work. It does not create the \startframe macro at all > -- is this something custom? I don't know how to use this "startframe" yet. So, I am doing like this right now: (numbers like 2-3 or 2- don't work yet) === START code snip === \startbuffer[simplesteps] \startitemize \item First item \uncover[2,3,4]{\item Second item} \uncover[3,4]{\item Second item} \uncover[4]{\item Second item} \stopitemize \stopbuffer \simplestepsplaybuffer === STOP code snip === The "simplestepsplaybuffer" macro simply calls the simplesteps.playbuffer() lua function. This function plays the buffer and determines if it has to be played again or not. If it does, then it tex.print('\simplestepsplaybuffer'). The macros "uncover" determine how far the specification is from being played. If it is being played now, then show. If it is played "next", then show in gray. And so on. > I infer it’s about the slide title > so I have \startframe call \section but that should be taken as a > placeholder at most. In my own slide module I use > \{start,stop}section with the option placehead=no and rely on the > page header to display the slide title (i.e. current section > running head). That was the laziest way I could imagine :P I guess that's what I want to do. I just don't have the necessary knowledge yet. ;-) > Some remarks: > > - you should rename simplesteps.mkiv to t-simplesteps.mkiv, > indicating that it is a thirdparty module I will. I think I will have a bitbucket repository exclusively for modules. Then I will have the proper directory structure, the proper naming scheme and hopefully proper documentation, xml, etc. (lots of things to learn!) > - if you plan on expanding the code you eventually will come to > love this bit: http://wiki.contextgarden.net/System_Macros > - Context has a namespacing system which you might consider > switching to in the long term: > http://tex.stackexchange.com/q/58654 > but it’s arguably an advanced method Well, I do want to do it the right (recommended) way! > - maybe switch to mkvi as named parameters make rewriting > macros a breeze Would you elaborate a bit further? >> Is it ok if I send a PDF sample to the list? I hope you can use the TEX file attached. Cheers, André Caldas. simpletest.tex Description: TeX document ___ 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] New module: simplesteps.
Well since Raw Steps did not work with mkiv, I tried making a very very simple module for a "beamer-like" behaviour. I don't really know how to write a module... but here is what I did: https://bitbucket.org/andrecaldas/math-video-classes/src/9116599821fc246cb54d3e6d7b8e6304649eaffb/lib?at=default I use \startbuffer and \stopbuffer, and also Lua. As I said, I don't really know how to write a module... comments are very welcome. Is it ok if I send a PDF sample to the list? Cheers, André Caldas. ___ 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] Loading lua file.
Hello, Philipp! >> If I load a lua file from a module using >> \registerctxluafile{file}{1.001} >> or >> \ctxloadluafile{file} >> How can I be sure the file was in fact loaded? > > The related tracker output is quite comprehensive: > > \enabletrackers[resolvers.locating] > \ctxloadluafile{sometest} Nice! Thank you. In my case, it was not being loaded because I had syntax errors in the lua file. The file was found, but not loaded. I guess it is a very good reason to halt! Cheers, André Caldas. ___ 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] [IN TOPIC] new interview
> http://www.tug.org/interviews/voipio.html > http://www.lucet.fi/craftex Nice! ___ 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] Raw Steps.
Is there any working alternative to Raw Steps? I need an alternative without JavaScript because the slides PDF will become JPG and then OGV/MPG/MP8... The idea is to record a lecture on video and then play it back with the slides alongside. https://bitbucket.org/andrecaldas/math-video-classes Cheers, André Caldas. ___ 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] OOP in Metafun.
>> But I would like to use some "object oriented" like approach. >> [...] >> How do I do that in METAFUN/METAPOST? > > You may want to take a look at my attempt: > > http://users.dimi.uniud.it/~nicola.vitacolonna/home/content/metappeal Looks nice! I didn't find any "license" explaining the licensing terms. André Caldas. ___ 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] OOP in Metafun.
> But I would like to use some "object oriented" like approach. I have done some OOP like coding... https://bitbucket.org/andrecaldas/math-video-classes/src/77036fe1001ede35e301305700943ac952089d32/src/environments/diagrams.tex?at=default This is my first METAFUN experience. Comments are very welcome! André Caldas. ___ 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] OOP in Metafun.
Hello, list! I am writing down a macro package for commutative diagrams using metafun. This is my first try: https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab20348c9a9c9e50740618173648979f45/src/environments/diagrams.tex?at=default Used here: https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab2034/src/products/assorted/open_mapping_theorem/notes/introduction.tex?at=default#cl-106 But I would like to use some "object oriented" like approach. That is, I'd like the diagram data structure to be set up like this: d = CD.new; d.vertex("$X$"); d.arrow("$f$"); d.vertex("$Y$"); d.newline; d.arrow("$\pi$"); d.arrow("$\pi$"); d.vertex("$A$"); d.arrow("$g$"); d.vertex("$B$"); or even in some "thelabel" similar fashion, d = CD.new; CD.vertex(d, "$X$"); CD.arrow(d, "$f$"); CD.vertex(d, "$Y$"); CD.newline(d); CD.arrow(d, "$\pi$"); CD.arrow(d, "$\pi$"); CD.vertex(d, "$A$"); CD.arrow(d, "$g$"); CD.vertex(d, "$B$"); How do I do that in METAFUN/METAPOST? Cheers, André Caldas. ___ 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] toppath
Hello! > My case is more complicated - a file is included from more other files in > various directory levels. I do this with \component: https://bitbucket.org/andrecaldas/math-video-classes/src/92a8e5b1a6eee07ed3475e20b54b0a566ab57738/src/products/assorted.tex?at=default André Caldas. ___ 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] toppath
Hello! > Is 'toppath:' prefix working? I use it only with \component, \environment, \product, \project. It works even if I do like this: $ mkdir build $ cd build $ context ../src/products/assorted.tex > context.exe Test\t-TopPath.mkiv > In this situation compilation fails. > How to make it work? It seems your observations in an e-mail below are right. Prefixes do not seem to work with \input. I don't know if prefixes are supposed to work or not with \input... but this issue is not related to toppath. Cheers, André Caldas. ___ 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] RFC: path relative to current file.
>> Are we giving up the feature? I was kind of using it already... :-( > > you have a messed up system ... the code is in data-pre.lua Indeed! :-) Sorry for the mess! Now, I have a bug at data-pre.lua. The variable inputstack is not defined there. Here is a fix: diff --git a/tex/context/base/data-pre.lua b/tex/context/base/data-pre.lua index 40b430b..3ef8c59 100644 --- a/tex/context/base/data-pre.lua +++ b/tex/context/base/data-pre.lua @@ -91,6 +91,7 @@ prefixes.home = function(str) end local function toppath() +local inputstack = resolvers.inputstack local pathname = dirname(inputstack[#inputstack] or "") if pathname == "" then return "." ___ 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] RFC: path relative to current file.
Hello, Hans! I quoted this from your message: >>> local function toppath() >>> [...] >>> resolvers.toppath = topath When you commited version "eb24ffd", the following bug was introduced: >> There is a bug here. It should be >> resolvers.toppath = toppath >> (double "p" in the right side) > > In your local copy I presume, not here. Because of the bug (I presume), you removed the whole code. git diff -r eb24ffd tex/context/base/file-job.lua [...] @@ -553,22 +553,6 @@ function resolvers.jobs.currentenvironment() return topofstack(v_environment) en local done = { } local tolerant = false -- too messy, mkii user with the wrong sructure should adapt -local function toppath() -local pathname = dirname(inputstack[#inputstack] or "") -if pathname == "" then -return "." -else -return pathname -end -end - -resolvers.toppath = topath ===> HERE IS THE BUG (right above) <=== - -resolvers.prefixes.toppath = function(str) -local fullname = cleanpath(joinpath(toppath(),str)) -return fullname -end Are we giving up the feature? I was kind of using it already... :-( Cheers, André Caldas. ___ 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] RFC: path relative to current file.
Hello! > local function toppath() > [...] > resolvers.toppath = topath There is a bug here. It should be resolvers.toppath = toppath (double "p" in the right side) André Caldas. -- - Por que altera a ordem natural da conversação! - Por que não? - Eu não gosto, não. - Você gosta quando copiam a mensagem original ao final do e-mail? ___ 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] [dev-context] Error while updating to new beta
>> Same error. But if I comment the definition of >> resolvers.prefixes.toppath, the error goes away. > > fixed (tested on opensuse and ubuntu) The problem was that in some places there was a toppath with double "p" (pp) and in some places it was topath with single "p" (p). Will "toppath" be brought back? Cheers, André Caldas. -- - Por que altera a ordem natural da conversação! - Por que não? - Eu não gosto, não. - Você gosta quando copiam a mensagem original ao final do e-mail? ___ 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] RFC: path relative to current file.
Hello! >> It would be REALLY NICE if the functionality of "pathrelativetome" was >> provided by ConTeXt. > > in file-job.lua add around the function 'process': > > local function toppath() > [...] > > \component toppath:/subpath/somefile.tex Works like a charm, Hans! Sorry I took so long to test... I copied file-job.lua from the GIT repository, and changed my tex files to use toppath:/path/to/file. For example: https://bitbucket.org/andrecaldas/math-video-classes/src/b743f22e4f567662ac55c1ac7dc1b6d13362e11d/src/products/assorted.tex?at=default Really nice! Thanks!! :-) Cheers, André Caldas. ___ 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] Upgrading to git repo.
Hello! I have the context standalone installed. How do I update it to reflect the last changes in the GIT repo? http://gitorious.org/context Cheers, André Caldas. -- - Por que altera a ordem natural da conversação! - Por que não? - Eu não gosto, não. - Você gosta quando copiam a mensagem original ao final do e-mail? ___ 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] RFC: path relative to current file.
1. check for "stack underflow"; and/or >>> >>> such things are dealt with >> >> By assert, I mean: >> assert(inputstack[#inputstack], "Input stack should never be empty >> when toppath() is called.") > > normally > > if inputstack[#inputstack] == nil then > assume path "." > end > > is good enough ... Is "inputstack[#inputstack] == nil" ever supposed to happen? When reading from stdin, maybe... then, it is ok. > (assert might make sense in situation where otherwise a > crash would occur, but that never happens here) If it is not supposed to happen, then it would indicate a bug, and should be detected as early as possible. A "crash" is a special case of that. But this is a matter of taste... :-) Cheers, André Caldas. ___ 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] RFC: path relative to current file.
>> 1. check for "stack underflow"; and/or > > such things are dealt with By assert, I mean: assert(inputstack[#inputstack], "Input stack should never be empty when toppath() is called.") >> 2. check if the file "somefile.tex" exists in the directory being >> popped from the stack. >> Just for "bug catching"... > > it all happens before a file is loaded so the normal reporting is applied I meant an "assert()" inside toppath() and cleanpath(). But, as you said, this kind of "assertion" belongs to a "test case". André Caldas. ___ 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] RFC: path relative to current file.
>> It would be REALLY NICE if the functionality of "pathrelativetome" was >> provided by ConTeXt. > > in file-job.lua add around the function 'process': You make me really happy, Hans! :-) I will change file-job.lua on my system to test. I can do this only on Wednesday. > local function toppath() > [...] >local pathname = dirname(inputstack[#inputstack] or "") I didn't check it in lua. But the unix command "dirname" returns "." if given an empty string. That is, $ dirname '' . I don't know when "inputstack" could be empty... but maybe a warning should be issued, and the return value of toppath should be declared undefined. That is, it would be an error to call toppath if "inputstack" is empty. > [...] > resolvers.toppath = topath toppath? (double "p") > Then you can something: > [...] > \component toppath:/subpath/somefile.tex Nice. > All given that the top of the inputstack is still ok. Maybe the code could have some sort of "assertion" to 1. check for "stack underflow"; and/or 2. check if the file "somefile.tex" exists in the directory being popped from the stack. Just for "bug catching"... > If needed I can push/pop some relative code to start/stopcomponent alike > code, in which case we will use a different prefix (no clue what name to > use) I don't think it is needed, since the toppath mechanism is rather generic. Writing "\component toppath:/subpath/somefile.tex" is fine by me. Unless you think that "start/stopcomponent" should be deprecated (or, at least, discouraged) in favour of this new version. Maybe it would be nice to have a function that returns the value of "inputstack[#inputstack]". But I don't know if it is useful... Thank you very very much for your time! André Caldas. ___ 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] PDF security settings
> allow/disallow printing &c. Set it free!!! :-P Technically speaking, I'd like to tell you that there is no easy way (without controlling the user's computer) to disallow printing. The viewer program has to VOLUNTARILY refuse itself to obey the user and opt to obey you. There is no easy way to accomplish that. But anyway... almost everything I have learned on the last few years, I owe it to people that are willing to set their knowledge free (as in freedom) on the internet. I have learned tools (CVS, SVN, mercurial), I have learned languages (C++, python, php), I have learned about LaTeX, I have learned about ConTeXt (thanks Hans et al). I have learned automake, autoconf. I have learned some GStremer. Etc, etc. And not only that... virtually, every tool I use today, I owe it to people who want to share. I owe it to Hans (et al) that we have ConTeXt. We have TeX, Lua, LuaTeX, Python, Django, Rails, Ruby, PHP, Postgres, MySQL, LibreOffice, GCC, Mercurial, Subversion, many compilers, Apache, KDE, Gnome, Kile, etc, etc... Where would you be now if it was not for those and for the freedom they gave you? Don't give just the crumbs to your readers! Think of all you have received until now... :-) Recommended reading: https://www.gnu.org/philosophy/right-to-read.html Cheers, André Caldas. ___ 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] Using a search engine.
Once, I've read about someone who, a long time ago, found it really difficult to look for pages related to LaTeX on the internet. He used to get a lot of "fetish" related pages!!! Since "context" is a very common word, I'd like to know from ConTeXt users... How do you look for "ConTeXt" stuff using search engines? Cheers, André Caldas. ___ 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] Commutative diagrams.
Dear gurus, How can I make commutative diagrams in ConTeXt? Cheers, André Caldas. ___ 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] RFC: path relative to current file.
Hello, list! A while ago, I raised a question about how to, in a tex, specify a file with a path relative to the currently being processed file. http://www.ntg.nl/pipermail/ntg-context/2012/069132.html http://www.ntg.nl/pipermail/ntg-context/2012/068902.html Even though the issue did not get much attention, I do believe it is the right thing to do. I wrote a module to implement a macro I called "\pathrelativetome". My code is still a lot ugly. I don't know how to do many things in Lua, LuaTeX and ConTeXt. It can be found here: https://bitbucket.org/andrecaldas/math-video-classes/src/bade74046a6b/lib It would be REALLY NICE if the functionality of "pathrelativetome" was provided by ConTeXt. call it using, for example: context --usemodule=lib/relativetome src/products/assorted.tex Ugly things remaining: 1. pathstack should be initialized with the path of the first tex script. I.e.: src/products/, instead of pathstack[1] = 'src/products' 2. Functions pop and push should be local. (relativetome.lua) 3. Call function "pop" automatically, just like the "push" function is called automatically. 4. Avoid having to define "\xproject", "\xproduct", "\xcomponent" and "\xenvironment". http://www.ntg.nl/pipermail/ntg-context/2012/069305.html Any suggestions/improvements are very welcome! Cheers, André Caldas. ___ 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] Macro "inside" \component.
> \startproduct text > \component [\MyMacro] > \stopproduct Didn't work for me... does it work for you? ___ 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] Frozen callback.
>>> Why is "document.MyCharacterMess" a string? >> >> The sequencers use loadstring() internally (util-seq.lua), so you >> need to supply the namespace as a string. This happens all over >> the place with action/callbacks. > > more flexible this way (one can redefine, nil or whatever such functions) It is like a "pointer to a pointer". Or a reference to a reference, since we do not use pointers in Lua. ___ 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] Macro "inside" \component.
Hello! > Why don’t you use the \usepath command. Because it is too magical. We DO need magic to locate system libraries. But we DO NOT need magic to locate our own project files. For this reason, the C language has #include and #include "local_lib.h" I don't want the file to be searched in a pile of directories. I know exactly where the component is: it is, here: open_mapping_theorem/notes.tex but this location is relative to the product directory: products/functional_analysis. Which is relative to the project directory. The recommended project structure is: project/products/components. Each product is aware of its own components. And each component is aware of its "sub-components". But the components or the subcomponents do not need to know anything about where exactly they live inside the project. The only magic the products need, for example, is that project wide environments are loaded automatically. Suppose I have a project with a 100 products with 20 components each. With all magic provided by the usepath, my components will have to be too much aware of the remaining other 100 projects. Files will have to have unique names, even if they are in different products. I don't really know the internals of it, but the \ctxloadluafile{module} looks like an example. In my system there is the file: /usr/share/texmf/tex/context/base/file-job.mkiv inside it, there is a \ctxloadluafile to load "file-job.lua". It seems to me that ctxloadluafile looks for the lua file in the same directory of the mkiv file that includes it. If this is not the way ctxloadluafile is implemented, I would suggest that it be. If you load the module using context --usemodule=my_lib/my_module.mkiv my_product.tex, then, the best bet is to load the my_module.lua from the same directory where my_module.mkiv lives in. I am not sure, but I guess this is the behaviour that makes most sense. Another example is the PHP language. The behaviour of the "required()" command is to look on the current working directory. And for that reason, the PHP codes are full of: require(dirname(__FILE__)."/path/relative/file_to_include.php"); I believe thing should be: 1. Predictable. 2. Local. For that reason, I don't want to use "\usepath". But even if this was not the case, it makes no sense to me that I cannot call "\component \macroname". Isn't it an expected behaviour? André Caldas. ___ 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] Macro "inside" \component.
Hi! This works: \startproduct assorted \project math_video_classes \unexpanded\def\pathrelativetome% {src/products/assorted/open_mapping_theorem/notes} %\component{\pathrelativetome} \component{src/products/assorted/open_mapping_theorem/notes} \stopproduct But this does not work (no PDF is generated): \startproduct assorted \project math_video_classes \unexpanded\def\pathrelativetome% {src/products/assorted/open_mapping_theorem/notes} \component{\pathrelativetome} %\component{src/products/assorted/open_mapping_theorem/notes} \stopproduct WHY? Thank you, André Caldas. ___ 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] Frozen callback.
I am trying to redefine the ’open_read_file’ callback. > [...] > utilities.sequencers.appendaction(textfileactions, > "system","document.MyCharacterMess") All I want is to get the full path (or path relative to lfs.currentdir()). Is "textfileactions" the action I should trap? Also, shall I use "after" or "before" instead of "system"? Since it is a module, probably I should use "system", right? Just want to be sure... Thank you all! André Caldas. ___ 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] Frozen callback.
Hello, Hans! >> Shall I simply do something like this? >> >> [...] > > this is not the recommended way .. better do somethign like this: > [...] > function document.MyCharacterMess(str,filename) Loved your function naming! :-) What is this "str"? > if file.nameonly(filename) == "ward" then > str = table.concat(string.totable(str,"."), " + ") What is this doing? > [...] > utilities.sequencers.appendaction(textfileactions, > "system","document.MyCharacterMess") Why is "document.MyCharacterMess" a string? Isn't it less error-prone to use the function itself, instead of its name? Sorry for my naive basic questions... :-) Cheers, André Caldas. ___ 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] Frozen callback.
>> I am trying to redefine the ’open_read_file’ callback. > > [...] > direct callback access is disabled. There are usually some layers > of abstraction on top of them, different ones for different > callbacks. Mapping them all is a huge effort, so best refer to > the source. > > In your case the function resolvers.openers.helpers.textopener() > takes the place of the open_read_file callback. It can be found > in data-tex.lua. Shall I simply do something like this? local function textopener(tag, filename, filehandle, coding) result = old_textopener(tag, filename, filehandle, coding) -- Do lots of things return result end resolvers.openers.helpers.textopener = textopener Thank you, André Caldas. ___ 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] Frozen callback.
Hello! I am trying to redefine the ’open_read_file’ callback. I am getting this error: callback ’open_read_file’ is frozen Why is it "frozen"? Can I "unfreeze it"? André Caldas. ___ 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] My own module.
> You have to load the lua file in your module, e.g. > \ctxloadluafile{my_module}. Thank you! André Caldas. ___ 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] My own module.
Hello! >> Where should I put a module if I have the following project strucutre? >> > You can load your module with \usemodule[…] > from your environment file. So, inside "environments/load_mymodule.tex" I call \usemodule[mymodule] But how will it be found? My module is composed of a mkiv and a lua file. When I load it, the mkiv seems to get loaded, but the lua file is not being loaded. How do I get the "lua" file to get loaded as well? Cheers, André Caldas. ___ 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] My own module.
> Where should I put a module if I have the following project strucutre? Can't I have a module inside a project? ___ 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] My own module.
Where should I put a module if I have the following project strucutre? math-books/ math-books.tex environments/ layout.tex products/ book1.tex book1/ chapter1.tex chapter2.tex book2.tex book2/ chapter1.tex chapter2.tex I have a "my_module.lua" and a "my_module.tex". Where should I put those files? How do I configure my project to use my module? How do I call my own module from "book1/chapter1.tex", for example? Thank you, André Caldas. ___ 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] Current source directory.
> My mistake: I tested the code I gave you in \startluacode, but then > for the e-mail I wrapped it in \cldcontext. I had tested it using startluacode, also. :-( > These two versions both work, and I actually tested them this time: > > \startluacode > context(environment.runpath .. '/' .. > file.pathpart(resolvers.inputstack[#resolvers.inputstack]) > ) > \stopluacode I get this: ! LuaTeX error :3: attempt to get length of field 'inputstack' (a nil value) stack traceback: :3: in main chunk. system > tex > error on line 7 in file products/topologia_geral.tex: LuaTeX error ... [...] })ted text> ...resolvers.inputstack]) \luat_start_lua_code_indeed ...ua \zerocount {#1}} l.7 \stopluacode > \cldcontext{ > environment.runpath .. '/' .. > file.pathpart(resolvers.inputstack[table.getn(resolvers.inputstack)]) > } And this: ! LuaTeX error :1: bad argument #1 to 'getn' (table expected, got nil) stack traceback: [C]: in function 'getn' :1: in main chunk. system > tex > error on line 6 in file products/topologia_geral.tex: LuaTeX error ... [...] \cldcontext ...\directlua \zerocount {context(#1)} l.6 } > Sorry about that mistake. No need to apologize! :-) It seems that resolvers.inputstack is not defined in my system. Where is it defined in yours? file-res.lua? Thank you very very much, :-) André Caldas. ___ 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] Current source directory.
>> - Do I need to "include" "file-job.lua" somehow? > > No need to include it, it's part of the ConTeXt core. > [...] > Is it working for you? No. I get: ! LuaTeX error :1: attempt to get length of field 'inputstack' (a nil value) stack traceback: :1: in main chunk. system > tex > error on line 6 in file products/topologia_geral.tex: LuaTeX error ... [*snip] \cldcontext ...\directlua \zerocount {context(#1)} l.6 } By the way, context --version gives: mtx-context | ConTeXt Process Management 0.52 mtx-context | mtx-context | main context file: /usr/share/texmf/tex/context/base/context.mkiv mtx-context | current version: 2012.05.30 11:26 André Caldas. ___ 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] Current source directory.
Hi! > the following should work. > > \cldcontext{ > environment.runpath .. '/' .. > file.pathpart(resolvers.inputstack[#resolvers.inputstack]) > } Sorry, to ask such a dumb question... - Do I need to "include" "file-job.lua" somehow? André Caldas. ___ 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] Current source directory.
Dear Sietse, Thanks a lot!!! > Finally found it, after lots of trial-and-erroring through > likely-looking table names in file-job.lua: the stack of input files > is kept in resolvers.inputstack. I don't program any "lua". But I was taking a look at "file-job.lua" myself. I have a lot to learn!! :-) > Assuming (absolute path of invocation > dir) + (path of file relative to invocation dir) = the desired path, I don't mind this assumption. Actually, I don't mind having a path relative to the currdir. > the following should work. > > \cldcontext{ > environment.runpath .. '/' .. > file.pathpart(resolvers.inputstack[#resolvers.inputstack]) > } I will try this now. > You may or may not want to parse out any ./ and ../ components. No, I don't need that. > (If you do: helpful filename manipulation functions (such as > file.pathpart, indeed) may be found in l-file.lua.) Thanks for the tip. Might be useful someday. > Hope this helps, It does! :-) Although, I think there should be a "luatex" command for this. That is, something not related to ConTeXt. Thank you, André Caldas. ___ 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] Current source directory.
Thank you for yor time, Peter. But this is not what I wanted... :-( >> Is there a way to know the directory of the currently being processed >> source file? > > This works with mkiv: > > \starttext > PWD: \cldcontext{io.popen"pwd":read()} > \stoptext This gives the directory where the "context" command was called from. I want the directory where the "tex" file being processed lives in. For example, I have a component products/product/article.tex Inside a product products/product.tex I produce it by calling context products/product.tex I want to know a function that returns /fullpath_to_project/products/ when I call it from the script "products/product.tex". And I want it to return /fullpath_to_project/products/product/ when I call it from the script "products/product/article.tex". Cheers, André Caldas. ___ 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] Current source directory.
Hello! Is there a way to know the directory of the currently being processed source file? Something like dirname(__FILE__) in PHP. Cheers, André Caldas. ___ 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] Period at the end of a "alignment block".
>> I have a macro to typeset function definitions: >> >> \define[5]\functionarray >> [...] >> >> How should I implement my "functionarray"? > > > Use mathmatrix. > [...] Works very well, thank you. André Caldas. ___ 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] Period at the end of a "alignment block".
I have a macro to typeset function definitions: \define[5]\functionarray { \startalign[n=4, align={left,right,center,left}] \NC #1: \NC #2 \NC \to \NC #3 \NR \NC \NC #4 \NC \mapsto \NC #5 \stopalign } I use it like this: (notice the period at the end) \startformula \functionarray{f}{X}{Y}{x}{f(x)}. \stopformula I get the following error: Display math should end with \Ustopdisplaymath ... If I remove the ".", the error does not happen. How should I implement my "functionarray"? Thanks, André Caldas. ___ 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] Search path.
>> When I write a project, product, component or environment file, why >> would I want the references I made to be dependent on the directory >> where the script was called? Shouldn't things be like the >> #include "relative_path.h" >> used in the C language, for example? That is, shouldn't those paths be >> relative to the script that refers to them? [...] > > The way tex (and its path) are set up is that files are looked up on the > current path (.) or relative to it, or in the (tds compliant) tex tree. > Auxiliary files are created in the current directory. I thought the reason was TeX itself. I just had some hope that ConTeXt would "fix" this behavior some how. Since ConTeXt allows one to have products and contents relatively independent from the project itself, I thought that it would make sense to have the references to files independent from the project structure as well. Maybe I can just live with TEXINPUTS and BIBINPUTS... :-) I guess the magic could be at some extent done with "\usepath". Leaving the probably already extensively discussed "\usepath" precedence order for another discussion... > One can hardcode a path in the tex source if needed. Another option is to > move to the source path (something texmfstart --path ... texexec ... or > mtxrun --path ... --script context ...) but what's best depends on the kind > of project. I definitely prefer not to hard code paths in the source. Actually, I would like the "components" to not have to worry at all about where they live... I will study texmfstart. :-) > Do you really need to use context mkii? As it's a new project, using context > mkiv might be a better idea. No, I don't. I want to use always the preferred solution. I want to follow your guidelines and be enlightened... :-) How did you know I was using one and not the other? I didn't know it myself!!! Thank you very much for your help and for this great piece of software, Hans. André Caldas. ___ 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] Search path.
Hello, list! I am really new to ConTeXt. I am writing a book http://topologia-geral.ourproject.org/ It is written in LaTeX and I intend to migrate it to ConTeXt. I want to migrate and I want to be as far from HACKS as I can. So I want to know the recommended way to do things. One of my first difficulties comes from the "search path" used by texexec. It seems to me that the path searched for components, products and environments depends on the path were the script was called from. That is, it depends on the "current working directory". My question (honestly) is: - Why would I want this behavior? When I write a project, product, component or environment file, why would I want the references I made to be dependent on the directory where the script was called? Shouldn't things be like the #include "relative_path.h" used in the C language, for example? That is, shouldn't those paths be relative to the script that refers to them? Am I missing something? André Caldas. ___ 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 ___