# Page number at the bottom outer page margin ConTeX solution

Can I put page number on the bottom of the outer margin?

Please, take a look at awesome answers in this question. It works fine with Latex. Can I get ConTeX solution?

Page number at the bottom outer page margin

• `\setuppagenumbering[location=inmargin]` but that will still be in the footer. – Henri Menke Feb 24 '18 at 21:08

The place the page number in the margins of the text area you can use the `\setuptexttexts` commands which takes the same arguments as the commands to place header and footer texts. The exact position of the number can be controlled with a frame where you set the vertical and horizontal position with the `align` key.

``````\setuppagenumbering[location=none]

\setuptexttexts[margin][][{\framed[frame=off,width=max,height=max,align={middle,low}]{\prefixedpagenumber}}]

\showframe

\starttext
\dorecurse{10}{\input lorem\par}
\stoptext
``````

• `\setuptexttexts`. I didn't know that one. (+1) – Henri Menke Feb 24 '18 at 22:45
• It' almost perfect..but...How to change vertical position of page number to match baseline? I can change it even manually, but how? – ReRunner Feb 25 '18 at 17:49
• @ReRunner When you enable blank lines between paragraphs (`\setupwhitespace[big]`) the last line of the page will be at the same height as the page number. – Wolfgang Schuster Feb 28 '18 at 9:43
• @ReRunner `\framed[frame=off,width=max,height=max,align={middle,low},offset=\dimexpr\topskip-\strutht+.5\linewidth\relax]{\prefixedpagenumber}` – Henri Menke Feb 28 '18 at 20:19

There is no predefined `location` in the outer margin of the text block. You have to use layers for that. I adapted a really old solution of Wolfgang on the mailing list. You can consult his post if you need doublesided page numbers.

``````\setuppagenumbering[location=]

\definelayer
[pagenumber]
[width=\rightmarginwidth,
height=\textheight]

\startsetups[pagenumber]
\setlayer
[pagenumber]
[preset=middlebottom]
{\strut\pagenumber}
\stopsetups

\setupbackgrounds[state=repeat]

\setupbackgrounds
[text][rightmargin]
[background=pagenumber,
setups=pagenumber]

\starttext

\dorecurse{10}{\input lorem}

\stoptext
``````