Example for switching page numbering from roman to numeric in PDF outline
Hi all, I want to switch page numbering from roman(which is typical in frontmatter) to roman. I also want these to appear in PDF outline. Can someone provide an MWE? -- Respect, Shiv Shankar Dayal
Am 24.09.24 um 14:05 schrieb Shiv Shankar Dayal:
Hi all,
I want to switch page numbering from roman(which is typical in frontmatter) to roman. I also want these to appear in PDF outline.
Can someone provide an MWE?
It’s a bit unclear what your problem is. Try \setupuserpagenumber[numberconversion=romannumerals] Instead of “romannumerals” you can also use r, R, or, or RK. If you meant “Arabic” numerals, try n, N, o, or zero. Hraban
Try \setupuserpagenumber[numberconversion=romannumerals]
Instead of “romannumerals” you can also use r, R, or, or RK.
If you meant “Arabic” numerals, try n, N, o, or zero.
The problem is that PDF Outline does not show roman numerals. It shows page numbers in arabic numerals. -- Respect, Shiv Shankar Dayal
Am 24.09.24 um 16:14 schrieb Shiv Shankar Dayal:
The problem is that PDF Outline does not show roman numerals. It shows page numbers in arabic numerals.
Sorry, I misunderstood. I don’t know and can’t find any documentation on that. Did you try a different PDF viewer? The display of the PDF outline probably depends on the viewer. Maybe try \enabledirectives[references.bookmarks.preroll] or \setupheads[expansion=yes] I’m not sure if the numbering of bookmarks is related to expansion of their text. Hraban
Did you try a different PDF viewer? The display of the PDF outline probably depends on the viewer.
I used Evince and Okular(I am on Linux) and both work for LaTeX generated pdfs.
Maybe try \enabledirectives[references.bookmarks.preroll] or \setupheads[expansion=yes]
Tried both but they do not work. -- Respect, Shiv Shankar Dayal
Hi, I do not know how to do that properly (if someone has a solution, I'd also be interested), but here is something which seems to give a partial solution: ``` \usemodule[ipsum] \starttext \placecontent \section{Section 1} \dorecurse {6} \ipsum \pagebreak \section{Section 2} \def\romanpage{\convertnumber{romannumerals}{\userpage}} \setupuserpagenumber[ numberconversion=romannumerals, viewerprefix=\romanpage -, ] \dorecurse {6} \ipsum \stoptext ``` In section 2, pages are shown with roman numerals in the document and as (roman numerals)-(arabic numerals) in the outline with Okular and Evince. I don't know how to get only the first part, though. Best regards, Florent Le mar. 24 sept. 2024 à 17:20, Shiv Shankar Dayal < shivshankar.dayal@gmail.com> a écrit :
Did you try a different PDF viewer? The display of the PDF outline probably depends on the viewer.
I used Evince and Okular(I am on Linux) and both work for LaTeX generated pdfs.
Maybe try \enabledirectives[references.bookmarks.preroll] or \setupheads[expansion=yes]
Tried both but they do not work.
-- Respect, Shiv Shankar Dayal
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
Hi,
After looking at it a bit more, one solution can be found in the accepted
answer to this question:
https://tex.stackexchange.com/questions/108676/page-numbers-roman-number-and...
The following example is slightly adapted from Marco's answer:
```
\usemodule[ipsum]
\definesectionblock[roman][romanpages]
\definestructureconversionset [roman:pagenumber] [] [romannumerals]
\startsectionblockenvironment [bodypart]
\setcounter [userpage] [1]
\stopsectionblockenvironment
\starttext
\startstandardmakeup
\placecontent
\stopstandardmakeup
\startromanpages
\section{Roman numeral pages}
\dorecurse{6}{\ipsum\par}
\stopromanpages
\startbodymatter
\section{Arabic numeral pages}
\dorecurse{6}{\ipsum\par}
\stopbodymatter
\stoptext
```
The page numbers look correct in Okular.
Best regards,
Florent
Le mar. 24 sept. 2024 à 19:50, Florent Michel
Hi,
I do not know how to do that properly (if someone has a solution, I'd also be interested), but here is something which seems to give a partial solution:
``` \usemodule[ipsum]
\starttext
\placecontent
\section{Section 1}
\dorecurse {6} \ipsum
\pagebreak
\section{Section 2}
\def\romanpage{\convertnumber{romannumerals}{\userpage}} \setupuserpagenumber[ numberconversion=romannumerals, viewerprefix=\romanpage -, ]
\dorecurse {6} \ipsum
\stoptext ```
In section 2, pages are shown with roman numerals in the document and as (roman numerals)-(arabic numerals) in the outline with Okular and Evince. I don't know how to get only the first part, though.
Best regards, Florent
Le mar. 24 sept. 2024 à 17:20, Shiv Shankar Dayal < shivshankar.dayal@gmail.com> a écrit :
Did you try a different PDF viewer? The display of the PDF outline probably depends on the viewer.
I used Evince and Okular(I am on Linux) and both work for LaTeX generated pdfs.
Maybe try \enabledirectives[references.bookmarks.preroll] or \setupheads[expansion=yes]
Tried both but they do not work.
-- Respect, Shiv Shankar Dayal
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
Much thanks Florent. It works really well, perhaps you should add it to wiki.
On Wed, Sep 25, 2024 at 3:52 AM Florent Michel
Hi,
After looking at it a bit more, one solution can be found in the accepted answer to this question: https://tex.stackexchange.com/questions/108676/page-numbers-roman-number-and...
The following example is slightly adapted from Marco's answer:
``` \usemodule[ipsum]
\definesectionblock[roman][romanpages] \definestructureconversionset [roman:pagenumber] [] [romannumerals]
\startsectionblockenvironment [bodypart] \setcounter [userpage] [1] \stopsectionblockenvironment
\starttext \startstandardmakeup \placecontent \stopstandardmakeup \startromanpages \section{Roman numeral pages} \dorecurse{6}{\ipsum\par} \stopromanpages \startbodymatter \section{Arabic numeral pages} \dorecurse{6}{\ipsum\par} \stopbodymatter \stoptext ```
The page numbers look correct in Okular.
Best regards, Florent
Le mar. 24 sept. 2024 à 19:50, Florent Michel
a écrit : Hi,
I do not know how to do that properly (if someone has a solution, I'd also be interested), but here is something which seems to give a partial solution:
``` \usemodule[ipsum]
\starttext
\placecontent
\section{Section 1}
\dorecurse {6} \ipsum
\pagebreak
\section{Section 2}
\def\romanpage{\convertnumber{romannumerals}{\userpage}} \setupuserpagenumber[ numberconversion=romannumerals, viewerprefix=\romanpage -, ]
\dorecurse {6} \ipsum
\stoptext ```
In section 2, pages are shown with roman numerals in the document and as (roman numerals)-(arabic numerals) in the outline with Okular and Evince. I don't know how to get only the first part, though.
Best regards, Florent
Le mar. 24 sept. 2024 à 17:20, Shiv Shankar Dayal
a écrit : Did you try a different PDF viewer? The display of the PDF outline probably depends on the viewer.
I used Evince and Okular(I am on Linux) and both work for LaTeX generated pdfs.
Maybe try \enabledirectives[references.bookmarks.preroll] or \setupheads[expansion=yes]
Tried both but they do not work.
-- Respect, Shiv Shankar Dayal ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
-- Respect, Shiv Shankar Dayal
You are most welcome!
It works really well, perhaps you should add it to wiki.
Good idea! I have added it here: https://wiki.contextgarden.net/Command/definesectionblock I have also tentatively added an alternate version which weems to work too as a second example for the \setupuserpagenumber command ( https://wiki.contextgarden.net/Command/setupuserpagenumber ). Best regards, Florent Le mer. 25 sept. 2024 à 13:06, Shiv Shankar Dayal < shivshankar.dayal@gmail.com> a écrit :
Much thanks Florent. It works really well, perhaps you should add it to wiki.
On Wed, Sep 25, 2024 at 3:52 AM Florent Michel
wrote: Hi,
After looking at it a bit more, one solution can be found in the
accepted answer to this question: https://tex.stackexchange.com/questions/108676/page-numbers-roman-number-and...
The following example is slightly adapted from Marco's answer:
``` \usemodule[ipsum]
\definesectionblock[roman][romanpages] \definestructureconversionset [roman:pagenumber] [] [romannumerals]
\startsectionblockenvironment [bodypart] \setcounter [userpage] [1] \stopsectionblockenvironment
\starttext \startstandardmakeup \placecontent \stopstandardmakeup \startromanpages \section{Roman numeral pages} \dorecurse{6}{\ipsum\par} \stopromanpages \startbodymatter \section{Arabic numeral pages} \dorecurse{6}{\ipsum\par} \stopbodymatter \stoptext ```
The page numbers look correct in Okular.
Best regards, Florent
Le mar. 24 sept. 2024 à 19:50, Florent Michel
a écrit :
Hi,
I do not know how to do that properly (if someone has a solution, I'd
also be interested), but here is something which seems to give a partial solution:
``` \usemodule[ipsum]
\starttext
\placecontent
\section{Section 1}
\dorecurse {6} \ipsum
\pagebreak
\section{Section 2}
\def\romanpage{\convertnumber{romannumerals}{\userpage}} \setupuserpagenumber[ numberconversion=romannumerals, viewerprefix=\romanpage -, ]
\dorecurse {6} \ipsum
\stoptext ```
In section 2, pages are shown with roman numerals in the document and
as (roman numerals)-(arabic numerals) in the outline with Okular and Evince. I don't know how to get only the first part, though.
Best regards, Florent
Le mar. 24 sept. 2024 à 17:20, Shiv Shankar Dayal <
shivshankar.dayal@gmail.com> a écrit :
Did you try a different PDF viewer? The display of the PDF outline probably depends on the viewer.
I used Evince and Okular(I am on Linux) and both work for LaTeX generated pdfs.
Maybe try \enabledirectives[references.bookmarks.preroll] or \setupheads[expansion=yes]
Tried both but they do not work.
-- Respect, Shiv Shankar Dayal
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
-- Respect, Shiv Shankar Dayal
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
Florent Michel schrieb am 25.09.2024 um 00:17:
Hi,
After looking at it a bit more, one solution can be found in the accepted answer to this question: https://tex.stackexchange.com/questions/108676/page-numbers-roman-number-and...
The following example is slightly adapted from Marco's answer:
``` \usemodule[ipsum]
\definesectionblock[roman][romanpages] \definestructureconversionset [roman:pagenumber] [] [romannumerals]
\startsectionblockenvironment [bodypart] \setcounter [userpage] [1] \stopsectionblockenvironment
\starttext \startstandardmakeup \placecontent \stopstandardmakeup \startromanpages \section{Roman numeral pages} \dorecurse{6}{\ipsum\par} \stopromanpages \startbodymatter \section{Arabic numeral pages} \dorecurse{6}{\ipsum\par} \stopbodymatter \stoptext ```
The page numbers look correct in Okular.
Is there a reason why you create a new sectionblock? BTW: You can also reset userpagenumber instead of setting it back to 1 by hand. %%%% begin example \defineconversionset [frontpart:pagenumber] [] [romannumerals] \startsectionblockenvironment [bodypart] \resetuserpagenumber \stopsectionblockenvironment \starttext \startfrontmatter \completecontent \dorecurse{4} {\chapter{Chapter #1} \dorecurse{\numexpr#1*2\relax}{\samplefile{lorem}}} \stopfrontmatter \startbodymatter \dorecurse{4} {\chapter{Chapter #1} \dorecurse{\numexpr#1*2\relax}{\samplefile{lorem}}} \stopbodymatter \stoptext %%%% end example Wolfgang
participants (4)
-
Florent Michel
-
Henning Hraban Ramm
-
Shiv Shankar Dayal
-
Wolfgang Schuster