[NTG-context] t-letter

2013-01-20 Thread Henning Hraban Ramm
Hi Wolfgang et.al.,

once again I struggle with your fine letter module.

For my job application setup (that worked a year before) I already gave up, but 
I need my invoices working.

Did you recently change anything WRT subject line? It doesn’t show up any more.
(Latest ConTeXt MkIV beta in standalone.)

This used to work:

% Subject and date on the same line, date below logo
\defineletterelement[section][subject][fiee]%
{\bTABLE[frame=off]
\bTR

\bTD[width=\dimexpr169mm-\backspace\relax]\correspondenceparameter{subject}\eTD
\bTD{\tf\correspondenceparameter{date}}\eTD
%\bTD{\tf 2011-11-14}\eTD
\eTR
\eTABLE}

\setuplettersection[subject][alternative=fiee]

\startletter[subject={Invoice 1}]
...
\stopletter

(Yes, this isn’t a working minimal example. Perhaps you can tell me you changed 
this or that - otherwise I must dig deeper...)


Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___
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] Floats and footnotes don't obey focus=standard

2013-01-20 Thread Marco Patzer
Hi,

PDF links to floats and footnotes change the zoom setting to fit
height even though focus=standard is set. Links to chapters/sections
behave as expected. Example:

\setupinteraction
  [state=start,focus=standard]

\starttext
\in{figure}[foo]
\startplacefigure [reference=foo] \stopplacefigure
Footnote \startfootnote Footnote \stopfootnote
\stoptext

This issue was raised by devendra on tex.se¹.

Marco


[1] http://tex.stackexchange.com/q/94023/5245


signature.asc
Description: Digital 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
___

[NTG-context] Simple question: how do I get the filename in the footer

2013-01-20 Thread Gerben Wierda
Simple question, guys (and gals),

how do I get the filename (full path not needed) in the footer of my document? 
I want it there while writing the book and remove it in the final stages. I am 
using MKII (TeXLive 2011 still)

texexec --pdf --mode=editor --once ../products/prd_book.tex
TeXExec | processing document '../products/prd_book.tex'
TeXExec | no ctx file found
TeXExec | tex processing method: context
TeXExec | writing option file prd_book.top
TeXExec | using randomseed 712
TeXExec | tex engine: pdftex
TeXExec | tex format: cont-en.mkii
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
 restricted \write18 enabled.
 (/usr/local/texlive/2011/texmf/web2c/natural.tcx)
entering extended mode
(../products/prd_book.tex

ConTeXt  ver: 2011.05.18 18:04 MKII  fmt: 2011.11.14  int: english/english

Thanks,

G
___
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] Simple question: how do I get the filename in the footer

2013-01-20 Thread Philipp Gesang
Hi Gerben,

·

> how do I get the filename (full path not needed) in the footer
> of my document? I want it there while writing the book and remove
> it in the final stages. I am using MKII (TeXLive 2011 still)
 
if the name of the main file suffices, then the TeX command
\jobname is what you are looking for.

···

\setuppagenumbering[location=]
\setupfootertexts[pagenumber][{\jobname.tex}]
\starttext
\dorecurse{5}{\input knuth\page}
\stoptext

···

Regards
Philipp




pgpX2KnOO35O1.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
___

[NTG-context] t-filter for LilyPond enhancements

2013-01-20 Thread Henning Hraban Ramm
Hi Aditya et.al.,

I'm using t-filter with LilyPond for my songbooklets like this:

-

\def\readPDFfile#1{\externalfigure[#1]}

\usemodule[filter]
\defineexternalfilter[lilypond]
[continue=yes,
readcommand=\readPDFfile,
directory=lilytemp/,
output={\externalfilterbasefile.pdf},
filtercommand={lilypond -dbackend=eps -dinclude-eps-fonts 
-dno-gs-load-fonts -o"lilytemp/\externalfilterbasefile" 
"\externalfilterinputfile"}]

-

Now, I'd like my lilypond sections/buffers to have different names than just 
numbers; I'd prefer some unique IDs or even manually set names to be able to 
re-order them without the need of re-compiling.
I.e. if I change the order of songs in my songbook, all LilyPond snippets must 
get recalculated, even if they didn’t change.

Sorry if that’s mentioned in t-filter’s docs - I didn’t see it.

There are some more enhancements that I’d like to implement, e.g. checking the 
resulting files if there are several pages or using single notelines to let 
ConTeXt do the page breaking (like lilypond-book does with LaTeX). I guess that 
would be as simple as replacing my \readPDFfile with some Lua code - can you 
give me a hint how to do that?

Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___
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] Simple question: how do I get the filename in the footer

2013-01-20 Thread Gerben Wierda
On 20 Jan 2013, at 12:57, Philipp Gesang wrote:

> Hi Gerben,
> 
> ·
> 
>> how do I get the filename (full path not needed) in the footer
>> of my document? I want it there while writing the book and remove
>> it in the final stages. I am using MKII (TeXLive 2011 still)
> 
> if the name of the main file suffices, then the TeX command
> \jobname is what you are looking for.

Thanks but that is not the one. Because I use the standard project setup, and 
the job is always to typeset the file prd_book.tex, but I want the chapter file 
names (e.g. "chapter1.tex") in the footer.

So, prd_book contains:

\startbodymatter
 \component chapter1
 \component chapter2
 \component chapter3
\stopbodymatter

And I want "chapter1.tex" (maybe full path) in the footer.

G


> 
> ···
> 
> \setuppagenumbering[location=]
> \setupfootertexts[pagenumber][{\jobname.tex}]
> \starttext
> \dorecurse{5}{\input knuth\page}
> \stoptext
> 
> ···
> 
> Regards
> Philipp
> 
> 
> ___
> 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] Simple question: how do I get the filename in the footer

2013-01-20 Thread Philipp Gesang
·

> On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
> 
> > Hi Gerben,
> > 
> > ·
> > 
> >> how do I get the filename (full path not needed) in the footer
> >> of my document? I want it there while writing the book and remove
> >> it in the final stages. I am using MKII (TeXLive 2011 still)
> > 
> > if the name of the main file suffices, then the TeX command
> > \jobname is what you are looking for.
> 
> Thanks but that is not the one. Because I use the standard project setup, and 
> the job is always to typeset the file prd_book.tex, but I want the chapter 
> file names (e.g. "chapter1.tex") in the footer.
> 
> So, prd_book contains:
> 
> \startbodymatter
>  \component chapter1
>  \component chapter2
>  \component chapter3
> \stopbodymatter
> 
> And I want "chapter1.tex" (maybe full path) in the footer.

If the component identifier matches the file name (e.g. if you
use the asterisk instead of a name), you can use
\currentcomponent. So the main file foo.tex would look like:

\setuppagenumbering[location=]
%% footer:main file->component file
\setupfootertexts[pagenumber][{\jobname->\currentcomponent}]
\startproduct *
  \input ward \page
  \component bar
\stopproduct

And bar.tex:

\startcomponent *
  \input knuth \page
\stopcomponent

Hth
Philipp



-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


pgpDiZWb_os7E.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
___

[NTG-context] Figure captions in margin

2013-01-20 Thread Devendra Ghate
I am using a layout with wide right margin. For floats that are 
\textwidth wide, I can place captions in the margin 
using**\setupcaption[location=rightmargin,high/low].


However, for figures that are 
(*\textwidth+\marginwidth+\margindistance*) wide, I would like to *place 
the caption in the margin below the figure*. I have tried 
spacebefore=\vskip but it doesn't seem to do anything. Another option 
was to use default caption location (below the figure) and add \hspace 
before figure placement.

None of these work as I am not able to make spacebefore do anything.

*MWE*

\setuplayout[width=5cm, height=13cm,rightmargin=5cm]

\setupexternalfigures[option=empty]
\setupfloat[figure][location=inner]
%
\setupcaption
  [figure]
   [width=5cm,
location={rightmargin,low},
spacebefore=big]

%\setupcaption
  %[figure]
  %[width=5cm]

\starttext
  \showframe
  \placefigure{A small but important
  caption.}{\externalfigure[cow][width=10cm]}
\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] Figure captions in margin

2013-01-20 Thread Marco Patzer
On 2013–01–20 Devendra Ghate wrote:

> I am using a layout with wide right margin. For floats that are
> \textwidth wide, I can place captions in the margin
> using**\setupcaption[location=rightmargin,high/low].
> 
> However, for figures that are
> (*\textwidth+\marginwidth+\margindistance*) wide, I would like to
> *place the caption in the margin below the figure*.

For a recent project I had the similar requirements. I did not find
a proper solution. I attached an example of the code I used.
However, it has several issues:

1) Margin floats and texts overlay and need manual adjustment.
2) The baseline of the float description does not match the baseline
   of the main text (fixed using  manual trial and error). I used an
   ugly hack (toffset=7.5ex) to align the description vertically.
3) The \startplacesmartfigure is not very robust. My notes say “Do
   not indent \startplacesmartfigure”. I don't recall what the exact
   issue was.
4) Probably many more that I haven't discovered, yet.

Feel free to suggest fixes for the mentioned issues.

Marco
\useMPlibrary [dum]

\unprotect

\setupfloat
  [figure]
  [default={top,bottom}]

\setupfloat
  [table]
  [default={bottom,top}]

\definefloat
  [margintable]
  [margintables]
  [table]

\definefloat
  [marginfigure]
  [marginfigures]
  [figure]

\setupcaptions
  [width=\marginwidth,
   prefix=no]

\setupcaption
  [table]
  [location={outermargin, high}]

\setupcaption
  [figure]
  [location={outermargin, high}]

\setupcaption
  [marginfigure, margintable]
  [align=flushleft,
   location=bottom]

\setupcaption
  [table, figure]
  [way=bytext]

\setupfloat
  [marginfigure, margintable]
  [default=margin]

\definefloat
  [widetable]
  [widetables]
  [table]

\setupfloat
  [widetable]
  [location=inner]

\definefloat
  [widefigure]
  [widefigures]
  [figure]

\setupfloat
  [widefigure]
  [location=inner]

\defineframed
  [caption_framed]
  [frame=off,
   offset=overlay,
   location=high,
   toffset=7.5ex]

\starttexdefinition caption_command #1
  \caption_framed{#1}
\stoptexdefinition

\setupcaption
  [widetable]
  [location={outermargin, low},
   command=\caption_command]

\setupcaption
  [widefigure]
  [location={outermargin, low},
   command=\caption_command]

\newtoks\t_smart_figure_args

\starttexdefinition startplacesmartfigure [#1]
  \t_smart_figure_args={#1}
  \grabbufferdata
[smart_figure_buffer]
[startplacesmartfigure]
[stopplacesmartfigure]
\stoptexdefinition

\startluacode
  userdata = userdata or { }

  function userdata.do_place_smart_figure(width)
context.unprotect()
if tex.sp(width) <= tex.dimen.rightmarginwidth + tex.sp(".1pt") then
  context.startplacemarginfigure{tex.toks.t_smart_figure_args}
tex.print(buffers.getcontent("smart_figure_buffer"))
  context.stopplacemarginfigure()
else
  if tex.sp(width) <= tex.dimen.textwidth + tex.sp(".1pt") then
context.startplacefigure{tex.toks.t_smart_figure_args}
  tex.print(buffers.getcontent("smart_figure_buffer"))
context.stopplacefigure()
  else
context.startplacewidefigure{tex.toks.t_smart_figure_args}
  tex.print(buffers.getcontent("smart_figure_buffer"))
context.stopplacewidefigure()
  end
end
context.protect()
  end
\stopluacode

\starttexdefinition stopplacesmartfigure
  \scratchdimen\hsize
  \hsize\maxdimen
\setbox\scratchbox\vbox{\getbuffer[smart_figure_buffer]}
  \hsize\scratchdimen

  \luacode{userdata.do_place_smart_figure("\the\wd\scratchbox")}
\stoptexdefinition

\protect

\starttext

\startplacesmartfigure [title=Foo]
  \externalfigure [dummy] [width=\rightmarginwidth, height=3cm]
\stopplacesmartfigure

\dorecurse{5}{%%
  \input knuth\par}

\startplacesmartfigure [title=\input ward\par]
  \externalfigure [dummy] [width=\textwidth, height=8cm]
\stopplacesmartfigure

\startplacesmartfigure [title=\input ward\par]
  \externalfigure [dummy] [width=\dimexpr\textwidth+\rightmargintotal\relax, height=3cm]
\stopplacesmartfigure

\stoptext


signature.asc
Description: Digital 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] t-filter for LilyPond enhancements

2013-01-20 Thread Aditya Mahajan

On Sun, 20 Jan 2013, Henning Hraban Ramm wrote:


I'm using t-filter with LilyPond for my songbooklets like this:

-

\def\readPDFfile#1{\externalfigure[#1]}

\usemodule[filter]
\defineexternalfilter[lilypond]
[continue=yes,
readcommand=\readPDFfile,
directory=lilytemp/,
output={\externalfilterbasefile.pdf},
filtercommand={lilypond -dbackend=eps -dinclude-eps-fonts -dno-gs-load-fonts 
-o"lilytemp/\externalfilterbasefile" "\externalfilterinputfile"}]

-

Now, I'd like my lilypond sections/buffers to have different names than just 
numbers; I'd prefer some unique IDs or even manually set names to be able to 
re-order them without the need of re-compiling.
I.e. if I change the order of songs in my songbook, all LilyPond snippets must 
get recalculated, even if they didn’t change.


Does

\startlilypond[name=one]

\stoplilypond

what you are looking for? (see the docs for how this behaves behind the 
scenes)



There are some more enhancements that I’d like to implement, e.g. 
checking the resulting files if there are several pages or using single 
notelines to let ConTeXt do the page breaking (like lilypond-book does 
with LaTeX). I guess that would be as simple as replacing my 
\readPDFfile with some Lua code - can you give me a hint how to do that?


See grph-inc.*. I'll post an example later on how to handle single page 
and multipage pdfs differently.


Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Simple question: how do I get the filename in the footer

2013-01-20 Thread Gerben Wierda
On 20 Jan 2013, at 16:09, Philipp Gesang wrote:

> ·
> 
>> On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
>> 
>>> Hi Gerben,
>>> 
>>> ·
>>> 
 how do I get the filename (full path not needed) in the footer
 of my document? I want it there while writing the book and remove
 it in the final stages. I am using MKII (TeXLive 2011 still)
>>> 
>>> if the name of the main file suffices, then the TeX command
>>> \jobname is what you are looking for.
>> 
>> Thanks but that is not the one. Because I use the standard project setup, 
>> and the job is always to typeset the file prd_book.tex, but I want the 
>> chapter file names (e.g. "chapter1.tex") in the footer.
>> 
>> So, prd_book contains:
>> 
>> \startbodymatter
>> \component chapter1
>> \component chapter2
>> \component chapter3
>> \stopbodymatter
>> 
>> And I want "chapter1.tex" (maybe full path) in the footer.
> 
> If the component identifier matches the file name (e.g. if you
> use the asterisk instead of a name), you can use
> \currentcomponent. So the main file foo.tex would look like:
> 
>\setuppagenumbering[location=]
>%% footer:main file->component file
>\setupfootertexts[pagenumber][{\jobname->\currentcomponent}]
>\startproduct *
>  \input ward \page
>  \component bar
>\stopproduct
> 
> And bar.tex:
> 
>\startcomponent *
>  \input knuth \page
>\stopcomponent

Hi Philipp,

that runs into the problem that the file name might contain characters that TeX 
does not like, e.g. underscore. Is there a command to catch that?

(./c_loosely.tex
! Missing $ inserted.
 
$
 
   _
\currentcomponent ->c_
  loosely


Thanks,

G

> 
> Hth
> Philipp
> 
> 
> 
> -- 
> ()  ascii ribbon campaign - against html e-mail
> /\  www.asciiribbon.org   - against proprietary attachments
> ___
> 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] Simple question: how do I get the filename in the footer

2013-01-20 Thread Wolfgang Schuster

Am 20.01.2013 um 18:06 schrieb Gerben Wierda :

> On 20 Jan 2013, at 16:09, Philipp Gesang wrote:
> 
>> ·
>> 
>>> On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
>>> 
 Hi Gerben,
 
 ·
 
> how do I get the filename (full path not needed) in the footer
> of my document? I want it there while writing the book and remove
> it in the final stages. I am using MKII (TeXLive 2011 still)
 
 if the name of the main file suffices, then the TeX command
 \jobname is what you are looking for.
>>> 
>>> Thanks but that is not the one. Because I use the standard project setup, 
>>> and the job is always to typeset the file prd_book.tex, but I want the 
>>> chapter file names (e.g. "chapter1.tex") in the footer.
>>> 
>>> So, prd_book contains:
>>> 
>>> \startbodymatter
>>> \component chapter1
>>> \component chapter2
>>> \component chapter3
>>> \stopbodymatter
>>> 
>>> And I want "chapter1.tex" (maybe full path) in the footer.
>> 
>> If the component identifier matches the file name (e.g. if you
>> use the asterisk instead of a name), you can use
>> \currentcomponent. So the main file foo.tex would look like:
>> 
>>   \setuppagenumbering[location=]
>>   %% footer:main file->component file
>>   \setupfootertexts[pagenumber][{\jobname->\currentcomponent}]
>>   \startproduct *
>> \input ward \page
>> \component bar
>>   \stopproduct
>> 
>> And bar.tex:
>> 
>>   \startcomponent *
>> \input knuth \page
>>   \stopcomponent
> 
> Hi Philipp,
> 
> that runs into the problem that the file name might contain characters that 
> TeX does not like, e.g. underscore. Is there a command to catch that?

You can add the \nonknuthmode to your document which makes _ and ^ normal 
characters for text mode.

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] flashcards

2013-01-20 Thread Wolfgang Schuster

Am 19.01.2013 um 19:13 schrieb ai...@uni-koeln.de:

> migrating Wolfgang's flashcard example from mkii to mkiv, I changed all @@pp 
> to v_page_target_
> It was foreseeable that this is not sufficient:
> pages   > flushing realpage 16, userpage 1
> pages   > flushing realpage 16, userpage 1
> ! You can't use a prefix with `the character 1'.
> 
> system  > tex > error on line 58 in file testiv.tex: You can't use a 
> prefix with ` ...
> 
> 48 \setupbackgrounds[page][frame=on]
> 49
> 50 \starttext
> 51
> 52 \dorecurse{20}
> 53   {\startstandardmakeup[align=middle]
> 54Front side \recurselevel
> 55\stopstandardmakeup
> 56\startstandardmakeup[align=middle]
> 57Back side \recurselevel
> 58 >> \stopstandardmakeup}
> 59
> 60 \stoptext
> 61
> 
> 
>   1
> \arrangedpageN ->1
>  6
> now I'm stuck. any help?
> 
> code see http://wiki.contextgarden.net/User:Wolfgang_Schuster

Hi Peter,

I attached a fixed version of the code.

Wolfgang


flashcard.tex
Description: Binary data
___
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] t-letter

2013-01-20 Thread Wolfgang Schuster

Am 20.01.2013 um 11:32 schrieb Henning Hraban Ramm :

> Hi Wolfgang et.al.,
> 
> once again I struggle with your fine letter module.
> 
> For my job application setup (that worked a year before) I already gave up, 
> but I need my invoices working.
> 
> Did you recently change anything WRT subject line? It doesn’t show up any 
> more.
> (Latest ConTeXt MkIV beta in standalone.)

I changed the way how section and layer layouts defined, the current version of 
the module provides
the new command \definelettersectionalternative and 
\defineletterlayeralternative. For backwards
compatibility I still provide the old \defineletterlement command but there was 
a bug when
the command is used to create layouts for a section, a new version which fixes 
this is already online.

> This used to work:
> 
> % Subject and date on the same line, date below logo
> \defineletterelement[section][subject][fiee]%
>   {\bTABLE[frame=off]
>   \bTR
>   
> \bTD[width=\dimexpr169mm-\backspace\relax]\correspondenceparameter{subject}\eTD
>   \bTD{\tf\correspondenceparameter{date}}\eTD
>   %\bTD{\tf 2011-11-14}\eTD
>   \eTR
> \eTABLE}
> 
> \setuplettersection[subject][alternative=fiee]
> 
> \startletter[subject={Invoice 1}]
> ...
> \stopletter
> 
> (Yes, this isn’t a working minimal example. Perhaps you can tell me you 
> changed this or that - otherwise I must dig deeper…)


Below are two additional methods to create a customized layout for the section.

\usemodule[letter]

% Method 1: unique name for the element
%
% \definelettersectionalternative[mysubject][renderingsetups=mysubject]
%
% \startsetups[mysubject]
%   \bTABLE[frame=off]
% \bTR
%   
\bTD[width=\dimexpr169mm-\backspace\relax]\correspondenceparameter{subject}\eTD
%   \bTD{\tf\correspondenceparameter{date}}\eTD
%  %\bTD{\tf 2011-11-14}\eTD
% \eTR
%   \eTABLE
% \stopsetups
%
% \setuplettersection[subject][alternative=mysubject]

% Method 2: shared name (fiee) for the element with its name (subject) as prefix

\definelettersectionalternative[subject:fiee][renderingsetup=subject:fiee]

\startsetups[subject:fiee]
  \bTABLE[frame=off]
\bTR
  
\bTD[width=\dimexpr169mm-\backspace\relax]\correspondenceparameter{subject}\eTD
  \bTD{\tf\correspondenceparameter{date}}\eTD
 %\bTD{\tf 2011-11-14}\eTD
\eTR
  \eTABLE
\stopsetups

\setuplettersection[subject][alternative=fiee]

% Method 3: using the predefined setups alternative
%
% \startsetups[letter:section:subject]
%   \bTABLE[frame=off]
% \bTR
%   
\bTD[width=\dimexpr169mm-\backspace\relax]\correspondenceparameter{subject}\eTD
%   \bTD{\tf\correspondenceparameter{date}}\eTD
%  %\bTD{\tf 2011-11-14}\eTD
% \eTR
%   \eTABLE
% \stopsetups
%
% \setuplettersection[subject][alternative=setups]

\startletter[subject={Invoice 1}]
...
\stopletter

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] t-filter for LilyPond enhancements

2013-01-20 Thread Henning Hraban Ramm
Am 2013-01-20 um 17:57 schrieb Aditya Mahajan:

>> Now, I'd like my lilypond sections/buffers to have different names than just 
>> numbers; I'd prefer some unique IDs or even manually set names to be able to 
>> re-order them without the need of re-compiling.
>> I.e. if I change the order of songs in my songbook, all LilyPond snippets 
>> must get recalculated, even if they didn’t change.
> 
> Does
> 
> \startlilypond[name=one]
> 
> \stoplilypond
> 
> what you are looking for? (see the docs for how this behaves behind the 
> scenes)

Oh, so simple? Great, that’s exactly what I meant. Since I would normally set 
[name=\currentcomponent], can I make that default?

>> There are some more enhancements that I’d like to implement, e.g. checking 
>> the resulting files if there are several pages or using single notelines to 
>> let ConTeXt do the page breaking (like lilypond-book does with LaTeX). I 
>> guess that would be as simple as replacing my \readPDFfile with some Lua 
>> code - can you give me a hint how to do that?
> 
> See grph-inc.*. I'll post an example later on how to handle single page and 
> multipage pdfs differently.

Thanks, handling of multipage PDFs might help, but I’d try a different 
approach: LilyPond can generate EPS/PDF for single note systems and writes the 
number of them into a simple text file. I’d parse that with Lua and place all 
those small PDFs. I just need a clue how I must define t-filter’s "readcommand" 
as a Lua function.

Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___
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 gif image

2013-01-20 Thread Aditya Mahajan

If I try to include a gif image

\starttext
\externalfigure[a.gif]
\stoptext

I get the following error:

ConTeXt  ver: 2013.01.17 18:16 MKIV  fmt: 2013.1.20  int: english/english

(/opt/context-minimals/texmf-context/tex/context/base/cont-new.mkiv) 
(test.tex{/opt/context-minimals/texmf-fonts/fonts/map/pdftex/context/mkiv-base.map}{/opt/context-minimals/texmf-fonts/fonts/map/dvips/lm/lm-math.map}{/opt/context-minimals/texmf-fonts/fonts/map/dvips/lm/lm-rm.map}
! LuaTeX error 
...uild/src/tex/texmf-context/tex/context/base/l-string.lua:85: bad 
argument #2 to 'lpegmatch' (string expected, got nil)

stack traceback:
[C]: in function 'lpegmatch'
	...uild/src/tex/texmf-context/tex/context/base/l-string.lua:85: in 
function 'longtostring'
	...uild/src/tex/texmf-context/tex/context/base/grph-inc.lua:1224: 
in function 'runprogram'
	...uild/src/tex/texmf-context/tex/context/base/grph-inc.lua:1362: 
in function 'converter'
	...uild/src/tex/texmf-context/tex/context/base/grph-inc.lua:600: 
in function 
<...uild/src/tex/texmf-context/tex/context/base/grph-inc.lua:498>

(...tail calls...)
	...uild/src/tex/texmf-context/tex/context/base/grph-inc.lua:885: 
in function 'identifier'
	...uild/src/tex/texmf-context/tex/context/base/grph-inc.lua:903: 
in function 'identify'

[string "\directlua "]:1: in main chunk.

1 \starttext
2 \externalfigure[a.gif]
3 >>  \stoptext
4


\grph_include_place ...ctxlua {figures.identify()}
  \ifconditional 
\c_grph_inc...

\grph_include_figure ...h_include_place [#1][][#2]
  \else 
\grph_include_place ...

\syst_helpers_triple_empty_three_spaced ...{#3}][]


   \stoptext
l.3 \stoptext

Did something change in how gif images are handled? (I do have both 
graphicmagic and imagemagic installed).


Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] t-filter for LilyPond enhancements

2013-01-20 Thread Aditya Mahajan

On Sun, 20 Jan 2013, Henning Hraban Ramm wrote:


Am 2013-01-20 um 17:57 schrieb Aditya Mahajan:


Now, I'd like my lilypond sections/buffers to have different names than just 
numbers; I'd prefer some unique IDs or even manually set names to be able to 
re-order them without the need of re-compiling.
I.e. if I change the order of songs in my songbook, all LilyPond snippets must 
get recalculated, even if they didn’t change.


Does

\startlilypond[name=one]

\stoplilypond

what you are looking for? (see the docs for how this behaves behind the scenes)


Oh, so simple? Great, that’s exactly what I meant. Since I would normally set 
[name=\currentcomponent], can I make that default?


Unfortunately no. The name key is reset at every `\startexternalfilter`; 
otherwise it will be difficult to mix `name=` with normal usage.



There are some more enhancements that I’d like to implement, e.g. checking the 
resulting files if there are several pages or using single notelines to let 
ConTeXt do the page breaking (like lilypond-book does with LaTeX). I guess that 
would be as simple as replacing my \readPDFfile with some Lua code - can you 
give me a hint how to do that?


See grph-inc.*. I'll post an example later on how to handle single page and 
multipage pdfs differently.


Thanks, handling of multipage PDFs might help, but I’d try a different 
approach: LilyPond can generate EPS/PDF for single note systems and 
writes the number of them into a simple text file. I’d parse that with 
Lua and place all those small PDFs. I just need a clue how I must define 
t-filter’s "readcommand" as a Lua function.


Something like this:

\def\ParseLilypondFile#1%
   % #1 is the name of the output file
   {\ctxlua{thirddata.parselilypondfile("#1")}

\startluacode
  thirddata = thirddata or {}
  function thirddata.parselilypondfile(name)
--- parse "name" file as you wish and
--- generate approapriate context(...) commands
--- to write back to ConTeXt
  end
\stopluacode

\defineexternalfilter[lilypond]
   [
 .
 readcommand=\ParseLilypondFile,
 
   ]

Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] t-filter for LilyPond enhancements

2013-01-20 Thread Henning Hraban Ramm
Am 2013-01-20 um 21:19 schrieb Aditya Mahajan:
> Unfortunately no. The name key is reset at every `\startexternalfilter`; 
> otherwise it will be difficult to mix `name=` with normal usage.

What do you think about using UIDs (or maybe some hash value of the buffer) 
instead of serial numbers? It might help with other uses of t-filter to be able 
to re-order the filter sections without re-compiling.

>> Thanks, handling of multipage PDFs might help, but I’d try a different 
>> approach: LilyPond can generate EPS/PDF for single note systems and writes 
>> the number of them into a simple text file. I’d parse that with Lua and 
>> place all those small PDFs. I just need a clue how I must define t-filter’s 
>> "readcommand" as a Lua function.
> 
> Something like this:
> 
> \def\ParseLilypondFile#1%
>   % #1 is the name of the output file
>   {\ctxlua{thirddata.parselilypondfile("#1")}
> 
> \startluacode
>  thirddata = thirddata or {}
>  function thirddata.parselilypondfile(name)
>--- parse "name" file as you wish and
>--- generate approapriate context(...) commands
>--- to write back to ConTeXt
>  end
> \stopluacode
> 
> \defineexternalfilter[lilypond]
>   [
> .
> readcommand=\ParseLilypondFile,
> 
>   ]

Thank you very much! It’s been a while since I wrote my last Lua code for 
ConTeXt...
I’ll just update the LilyPond wiki page (and then delete everything about the 
old LilyPond module).

Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___
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] t-letter

2013-01-20 Thread Henning Hraban Ramm
Am 2013-01-20 um 18:42 schrieb Wolfgang Schuster:

> Below are two additional methods to create a customized layout for the 
> section.

Thank you very much - "of course" that works!
I’ll try to document some more t-letter basics in the wiki...

Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___
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] Simple question: how do I get the filename in the footer

2013-01-20 Thread Gerben Wierda
On 20 Jan 2013, at 18:34, Wolfgang Schuster wrote:

> 
> Am 20.01.2013 um 18:06 schrieb Gerben Wierda :
> 
>> On 20 Jan 2013, at 16:09, Philipp Gesang wrote:
>> 
>>> ·
>>> 
 On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
 
> Hi Gerben,
> 
> ·
> 
>> how do I get the filename (full path not needed) in the footer
>> of my document? I want it there while writing the book and remove
>> it in the final stages. I am using MKII (TeXLive 2011 still)
> 
> if the name of the main file suffices, then the TeX command
> \jobname is what you are looking for.
 
 Thanks but that is not the one. Because I use the standard project setup, 
 and the job is always to typeset the file prd_book.tex, but I want the 
 chapter file names (e.g. "chapter1.tex") in the footer.
 
 So, prd_book contains:
 
 \startbodymatter
 \component chapter1
 \component chapter2
 \component chapter3
 \stopbodymatter
 
 And I want "chapter1.tex" (maybe full path) in the footer.
>>> 
>>> If the component identifier matches the file name (e.g. if you
>>> use the asterisk instead of a name), you can use
>>> \currentcomponent. So the main file foo.tex would look like:
>>> 
>>>  \setuppagenumbering[location=]
>>>  %% footer:main file->component file
>>>  \setupfootertexts[pagenumber][{\jobname->\currentcomponent}]
>>>  \startproduct *
>>>\input ward \page
>>>\component bar
>>>  \stopproduct
>>> 
>>> And bar.tex:
>>> 
>>>  \startcomponent *
>>>\input knuth \page
>>>  \stopcomponent
>> 
>> Hi Philipp,
>> 
>> that runs into the problem that the file name might contain characters that 
>> TeX does not like, e.g. underscore. Is there a command to catch that?
> 
> You can add the \nonknuthmode to your document which makes _ and ^ normal 
> characters for text mode.

Is that limited to a {}-scope? And more importantly, that catches ^ and _, but 
what about whitespace etc. Isn;t there a true verbatim that I can use on a 
macro like \currentcomponent? Something along the lines of 
\verbatimexpand{\currentcomponent}?

G

> 
> 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
> ___

___
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] Simple question: how do I get the filename in the footer

2013-01-20 Thread Aditya Mahajan

On Sun, 20 Jan 2013, Gerben Wierda wrote:


You can add the \nonknuthmode to your document which makes _ and ^ normal 
characters for text mode.


Is that limited to a {}-scope? And more importantly, that catches ^ and 
_, but what about whitespace etc. Isn;t there a true verbatim that I can 
use on a macro like \currentcomponent? Something along the lines of 
\verbatimexpand{\currentcomponent}?


Untested: \filename{\currentcomponent}

Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \asciimode does not work with gnuplot module

2013-01-20 Thread Marco Patzer
Hi,

When \asciimode is set some version info is printed instead of the
graph. Example:

\usemodule [gnuplot]
\asciimode

\starttext
  \startGNUPLOTscript [foo]
plot sin(x)
  \stopGNUPLOTscript
  \useGNUPLOTgraphic [foo]
\stoptext

Marco


signature.asc
Description: Digital 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] \asciimode does not work with gnuplot module

2013-01-20 Thread Mojca Miklavec
On Sun, Jan 20, 2013 at 11:06 PM, Marco Patzer wrote:
> \usemodule [gnuplot]
> \asciimode
>
> \starttext
>   \startGNUPLOTscript [foo]
> plot sin(x)
>   \stopGNUPLOTscript
>   \useGNUPLOTgraphic [foo]
> \stoptext

I need help with that one.

Mojca
___
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] Figure captions in margin

2013-01-20 Thread Devendra Ghate

Hello Marco,

Your code goes well beyond what I was looking for.

As I am working on a deadline right now, I am just going to use the 
frame trick to place the caption for wide figures.


However, expect to hear from me in future regarding this code.

Regards,
Devendra


On 01/20/2013 09:31 PM, Marco Patzer wrote:

On 2013--01--20 Devendra Ghate wrote:


I am using a layout with wide right margin. For floats that are
\textwidth wide, I can place captions in the margin
using**\setupcaption[location=rightmargin,high/low].

However, for figures that are
(*\textwidth+\marginwidth+\margindistance*) wide, I would like to
*place the caption in the margin below the figure*.

For a recent project I had the similar requirements. I did not find
a proper solution. I attached an example of the code I used.
However, it has several issues:

1) Margin floats and texts overlay and need manual adjustment.
2) The baseline of the float description does not match the baseline
of the main text (fixed using  manual trial and error). I used an
ugly hack (toffset=7.5ex) to align the description vertically.
3) The \startplacesmartfigure is not very robust. My notes say "Do
not indent \startplacesmartfigure". I don't recall what the exact
issue was.
4) Probably many more that I haven't discovered, yet.

Feel free to suggest fixes for the mentioned issues.

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
___


___
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
___