ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Simple question: how do I get the filename in the footer
@ 2013-01-20 11:37 Gerben Wierda
  2013-01-20 11:57 ` Philipp Gesang
  0 siblings, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2013-01-20 11:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 11:37 Simple question: how do I get the filename in the footer Gerben Wierda
@ 2013-01-20 11:57 ` Philipp Gesang
  2013-01-20 14:44   ` Gerben Wierda
  0 siblings, 1 reply; 9+ messages in thread
From: Philipp Gesang @ 2013-01-20 11:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 688 bytes --]

Hi Gerben,

···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···

> 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



[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 11:57 ` Philipp Gesang
@ 2013-01-20 14:44   ` Gerben Wierda
  2013-01-20 15:09     ` Philipp Gesang
  0 siblings, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2013-01-20 14:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 20 Jan 2013, at 12:57, Philipp Gesang wrote:

> Hi Gerben,
> 
> ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
> 
>> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 14:44   ` Gerben Wierda
@ 2013-01-20 15:09     ` Philipp Gesang
  2013-01-20 17:06       ` Gerben Wierda
  0 siblings, 1 reply; 9+ messages in thread
From: Philipp Gesang @ 2013-01-20 15:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1599 bytes --]

···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···

> On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
> 
> > Hi Gerben,
> > 
> > ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
> > 
> >> 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

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 15:09     ` Philipp Gesang
@ 2013-01-20 17:06       ` Gerben Wierda
  2013-01-20 17:34         ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2013-01-20 17:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 20 Jan 2013, at 16:09, Philipp Gesang wrote:

> ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
> 
>> On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
>> 
>>> Hi Gerben,
>>> 
>>> ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
>>> 
>>>> 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.
<inserted text> 
                $
<to be read again> 
                   _
\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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 17:06       ` Gerben Wierda
@ 2013-01-20 17:34         ` Wolfgang Schuster
  2013-01-20 20:41           ` Gerben Wierda
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2013-01-20 17:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 20.01.2013 um 18:06 schrieb Gerben Wierda <gerben.wierda@rna.nl>:

> On 20 Jan 2013, at 16:09, Philipp Gesang wrote:
> 
>> ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
>> 
>>> On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
>>> 
>>>> Hi Gerben,
>>>> 
>>>> ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
>>>> 
>>>>> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 17:34         ` Wolfgang Schuster
@ 2013-01-20 20:41           ` Gerben Wierda
  2013-01-20 21:32             ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2013-01-20 20:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 20 Jan 2013, at 18:34, Wolfgang Schuster wrote:

> 
> Am 20.01.2013 um 18:06 schrieb Gerben Wierda <gerben.wierda@rna.nl>:
> 
>> On 20 Jan 2013, at 16:09, Philipp Gesang wrote:
>> 
>>> ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
>>> 
>>>> On 20 Jan 2013, at 12:57, Philipp Gesang wrote:
>>>> 
>>>>> Hi Gerben,
>>>>> 
>>>>> ···<date: 2013-01-20, Sunday>···<from: Gerben Wierda>···
>>>>> 
>>>>>> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 20:41           ` Gerben Wierda
@ 2013-01-20 21:32             ` Aditya Mahajan
  2013-01-22 20:36               ` Gerben Wierda
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2013-01-20 21:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Simple question: how do I get the filename in the footer
  2013-01-20 21:32             ` Aditya Mahajan
@ 2013-01-22 20:36               ` Gerben Wierda
  0 siblings, 0 replies; 9+ messages in thread
From: Gerben Wierda @ 2013-01-22 20:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 20 Jan 2013, at 22:32, Aditya Mahajan wrote:

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

Works. When outside a component (e.g. index) it defaults to the string 'text'.

Thanks,

G

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

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-01-22 20:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-20 11:37 Simple question: how do I get the filename in the footer Gerben Wierda
2013-01-20 11:57 ` Philipp Gesang
2013-01-20 14:44   ` Gerben Wierda
2013-01-20 15:09     ` Philipp Gesang
2013-01-20 17:06       ` Gerben Wierda
2013-01-20 17:34         ` Wolfgang Schuster
2013-01-20 20:41           ` Gerben Wierda
2013-01-20 21:32             ` Aditya Mahajan
2013-01-22 20:36               ` Gerben Wierda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).