在 Lyx 中使用 fancyhdr 定位页码

发布于 2024-10-08 13:50:03 字数 261 浏览 11 评论 0原文

我正在尝试自定义页码的位置,使它们全部显示在 Lyx 的底部中心。我计划在文档的前言部分使用 fancyhdr 包,但收到以下错误消息:

“LaTex 错误:命令 /footruleskip 已定义”

我想这与我强制脚注格式有关,该格式可能已经是由 fancyhdr 包定义,因为我在序言中有以下内容:

\setlength{\skip\footins}{0.8cm}

有什么建议我如何解决这个问题并将页码位置与脚注设置一起设置?非常感谢。

I am trying to customise the position of the page number to make them all appear at the bottom centre in Lyx. I plan to use the fancyhdr package in the preamble section of the document, but I get the following error msg:

'LaTex Error: Command /footruleskip already defined'

I guess it has something to do with me forcing a footnote formatting which may already be defined by fancyhdr package, as i have the following in my preamble:

\setlength{\skip\footins}{0.8cm}

Any suggestion how I get around this problem and set the page number position together with the footnote setting? Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月打碎记忆 2024-10-15 13:50:03

此链接应该有帮助: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#定制_with_fancyhdr。您可以使用 lhead、chead、rhead、lfoot、cfoot 和 rfoot 命令来告诉它您的内容在哪里(章节名称、页码、自定义文本等)。我认为即使它们是空的,您仍然需要指定它们。对于仅位于底部中心的页码,这将是:

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}

也许您的错误可以通过使用 \renewcommand 来修复,而不是尝试定义已经存在的值。

This link should help: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Customising_with_fancyhdr. You can use the lhead, chead, rhead, lfoot, cfoot and rfoot commands to tell it what you what where (section names, page numbers, custom text, etc). I think you still need to specify them even if they are empty. For only a page number at the bottom center, that would be:

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}

Perhaps your error could be fixed by using \renewcommand instead of trying to define an already existing value.

一紙繁鸢 2024-10-15 13:50:03

我正在尝试用 LyX 完成我的论文,但像这样的小问题却让我丧命,因为我必须遵守学校的严格格式。不管怎样,当我搜索了一个多小时来寻找你的问题的答案时,这个页面出现了。我正在使用回忆录布局(有点,我已经不得不编辑它),因为我学校的乳胶 .cls 文件据说是基于 memoir.cls (尽管我坚持了几个小时,但我无法与 LyX 正常工作) )。我最终将此代码放入序言中,并根据我的格式要求在底部中心显示页码。

\makeevenfoot{headings}{}{\thepage}{}
\makeoddfoot{headings}{}{\thepage}{}
\makeevenhead{headings}{}{}{}
\makeoddhead{headings}{}{}{}

希望这对找到此页面的其他人有所帮助。现在,如果我能弄清楚如何告诉 LyX 我没有章节,并且我希望章节为 1 而不是 0.1。我可能只会使用section*并将我的部分称为“Section”#。不管怎样,我希望这能帮助那些像我一样因为使用 LyX 而差点打自己脸的人。

I'm trying to do my thesis with LyX and small problems like this are killing me because of having to adhere to the strict format of my school. Anyhow, this page came up as I searched for over an hour for the answer to your question. I'm using the memoir layout (kind of, I've already had to edit it) because my school's latex .cls file is supposedly based on memoir.cls (which I couldn't get to work correctly with LyX despite hours of persistence). I ended up putting this code into my preamble and it displayed the page numbers in the bottom-center per my formatting requirements.

\makeevenfoot{headings}{}{\thepage}{}
\makeoddfoot{headings}{}{\thepage}{}
\makeevenhead{headings}{}{}{}
\makeoddhead{headings}{}{}{}

Hope this helps anyone else that finds this page. Now if I can just figure out how to tell LyX that I have no chapters and I want sections to be 1 instead of 0.1. I'll probably just use section* and call my sections "Section" #. Anyway, I hope this helps someone who is as close to punching themselves in the face for using LyX as I am.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文