I need to generate a 100 pages document with only 1 number per page starting from 1 till 100. Any idea?
Asked
Active
Viewed 696 times
5
-
2The number at the bottom or where? – egreg Apr 12 '18 at 10:07
-
a number in the middle of a page. The number should be inside a triangle centered horizontally and vertically in the middle of the page. – Sortee Apr 12 '18 at 13:23
-
4How could we guess it? Please, make a *new* question with the *necessary* details; don't wait somebody asks for the background color of the triangle or the thickness of the sides. – egreg Apr 12 '18 at 13:35
-
Sorry, my fault – Sortee Apr 12 '18 at 13:37
2 Answers
8
Set up a 100x loop. All that is necessary is to leave vertical mode and clear the page, with page numbering turned on. Once can leave vertical mode with \leavevmode as I did here, or with an empty \mbox{}, or by typing any (non-printing) character, such as ~.
\documentclass{article}
\usepackage{pgffor}
\begin{document}
\foreach\x in{1,2,...,100}{\leavevmode\clearpage}
\end{document}
If you wanted the number as actual page data, rather than as a page numbering scheme,
\documentclass{article}
\usepackage{pgffor,graphicx}
\pagestyle{empty}
\begin{document}
\foreach\x in{1,2,...,100}{\vspace*{3in}\centerline{\scalebox{10}{\x}}\clearpage}
\end{document}
In reply to the comment about when the number of digits change, the key here would be to place the argument to \triangled in a fixed size box. That way, the triangle is the same size regardless of the number of digits.
\documentclass[a4paper,landscape]{article}
\usepackage{tikz}
\usepackage{mathptmx}
\usepackage{anyfontsize}
\usepackage{pgffor}
\usepgflibrary{shapes}
\newcommand*\triangled[1]{\tikz[baseline= (char.base)]{\node[regular polygon,
regular polygon sides=3, line width=1pt, draw, inner sep=4pt] (char) {%
\makebox[1em]{#1}};}}
\pagestyle{empty}
\begin{document}
\foreach\x in{1,2,...,100}{\vspace*{-2cm}\centerline{\scalebox{10}{%
\triangled{\x}}}\clearpage}
\end{document}
Steven B. Segletes
- 237,551
-
Seems to work. But I have a problem: I use this with a node and margin from bottom of the page change when number of digits change: \documentclass[a4paper,landscape]{article} \usepackage{tikz} \usepackage{mathptmx} \usepackage{anyfontsize} \usepackage{pgffor} \usepgflibrary{shapes} \newcommand\triangled[1]{\tikz[baseline= (char.base)]{ \node[regular polygon, regular polygon sides=3, line width=1pt, draw, inner sep=4pt] (char) {#1};}} \pagestyle{empty} \begin{document} \foreach\x in{1,2,...,100}{\vspace{-2cm}\centerline{\scalebox{10}{\triangled{\x}}}\clearpage} }\end{document} – Sortee Apr 12 '18 at 13:15
-
6
Here is a way with centering the page numbers with respect to the page center.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}
\pagestyle{empty}
\foreach \x in {1,...,100}{%
\tikz[remember picture,overlay]{\node[scale=45,blue] at (current page.center) {\x};}
\clearpage
}
\end{document}




