用latex编写程序,实现封面页第一页没有页码,从第二页开始为1,第三页为2,以此类推。
时间: 2023-10-07 13:07:39 浏览: 213
可以使用\pagestyle命令设置页面样式,再在需要重新开始计数的页面使用\pagenumbering命令重新设置页码计数器。下面是一个示例代码:
```latex
\documentclass{article}
\begin{document}
% 封面页第一页无页码
\thispagestyle{empty}
% 第二页开始页码为1
\pagestyle{plain}
\pagenumbering{arabic}
% 正文内容
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, tellus et vehicula lobortis, mi sem facilisis tortor, vel fringilla velit sapien et nibh. Nullam tincidunt porta orci, a rhoncus felis laoreet vel. Fusce volutpat risus nec tellus luctus, in fringilla nibh convallis. Suspendisse potenti. Curabitur auctor, erat in facilisis rhoncus, nisl tortor commodo turpis, vitae bibendum nunc felis vitae arcu. In hac habitasse platea dictumst. Sed interdum justo at augue elementum, a facilisis nulla blandit. Praesent imperdiet eleifend urna, eu pulvinar leo ornare quis.
% 重新开始计数
\clearpage
\pagenumbering{arabic}
\setcounter{page}{2}
% 第三页页码为2
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, tellus et vehicula lobortis, mi sem facilisis tortor, vel fringilla velit sapien et nibh. Nullam tincidunt porta orci, a rhoncus felis laoreet vel. Fusce volutpat risus nec tellus luctus, in fringilla nibh convallis. Suspendisse potenti. Curabitur auctor, erat in facilisis rhoncus, nisl tortor commodo turpis, vitae bibendum nunc felis vitae arcu. In hac habitasse platea dictumst. Sed interdum justo at augue elementum, a facilisis nulla blandit. Praesent imperdiet eleifend urna, eu pulvinar leo ornare quis.
\end{document}
```
需要注意的是,在使用\pagenumbering命令重新设置页码计数器后,要使用\setcounter命令将页码计数器设置为重新开始计数的页码。
阅读全文