5

I am trying to modify the footer of my article document using Tikz but I don't know where to start. My idea is to enclose the page number in a circle and between lines at the footer:

-------------------------------- ( Number ) ---------------------------

I tried to use scrlayer but I keep getting the cannot define \newpagestyle error. Another way I think, would be to use titlesec but I haven't found a good example so far, for footers. I also thought on using fancyhdr but I saw that it is not very easy to edit.

EDIT:

Using the first answer I modified it to get this:

Example

which is what I wanted, using this:

\documentclass{article}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[top=3cm, bottom=3cm, left=4cm, right=3cm]{geometry}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{%
\noindent%
\tikz[baseline]{\draw[color=back, line width=2pt] (-0.5, 0) -- (6, 0);}%
\protect\circled{\thepage}%
\tikz[baseline]{\draw[color=back, line width=2pt] (8, 0) -- (15, 0);}%
}

\newcommand*\circled[1]{%
\tikz[baseline]{\node[color=back, shape=circle,%
    draw, inner sep=4pt, line width=2pt] (char) {#1};}}

\begin{document}
\section{Section name}
\lipsum
\end{document}

I wanted this to match my Sections:

enter image description here

So, if someone has a better idea, I would appreciate it :) But the current answer is great so far

2
  • Please post a minimal document we can work with. The best approach depends heavily on not only your document class but on whether you are using any other packages for managing headers or footers. I take it that you mean titleps rather than titlesec? – cfr Jun 26 '15 at 21:26
  • Yes, I'm sorry. I'm just using article as documentclass and titlesec to modify sections and subsections – PerroNoob Jun 26 '15 at 22:20
3

What about the following code with fancyhdr package and tikz

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{lipsum}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\dotfill \protect\circled{\thepage} \dotfill}

\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline]{\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}

\begin{document}
\section{Section name}
\lipsum
\end{document}
3
  • Why dotted lines? :P Also, there is a space after the number which can be removed by removing the space before the last \dotfill. – Alenanno Jun 26 '15 at 21:57
  • yeap I did not pay attention of what type of line he wanted – Very23 Jun 26 '15 at 22:03
  • Isn't TikZ a bit overkill for this...? Oh, except the OP is loading it anyway so it doesn't really matter ;). – cfr Jun 26 '15 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.