我正在使用 Lyx 中的报告类来撰写我的论文。我希望第 1 章之前的页面(即包含摘要、致谢、目录、表格列表和图表列表的页面)页脚居中且无页眉。我目前使用 fancy header 包来编写页眉/页脚,但这会从标题页开始编写相同的页脚和页眉。我的 Lyx 文档的序言中有以下代码。
\AtBeginDocument{\newgeometry{hmargin=4cm}}
\raggedbottom
\pagenumbering{roman}
\geometry{textheight=245mm, textwidth=160mm, footskip=10mm}
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hspace*{\fill}\Huge\bfseries}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\Huge\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\renewcommand{\cftloftitlefont}{\hspace*{\fill}\Huge\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\setlength\cftbeforetoctitleskip{-7mm}
\setlength\cftbeforeloftitleskip{-25mm}
\setlength\cftbeforelottitleskip{-4mm}
\setlength\cftaftertoctitleskip{0mm}
\setlength\cftafterloftitleskip{0mm}
\setlength\cftafterlottitleskip{0mm}
\renewcommand\nomname{List of Abbreviations}
\renewcommand{\nomname}{\makebox[\linewidth]{List of Abbreviations}}
\renewcommand\cftchapfont{\fontsize{16}{18}\selectfont}
\setlength{\cftbeforechapskip}{-8pt}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsecfont{\fontsize{14}{16}\selectfont}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsecskip}{-12pt}
\renewcommand\cftsubsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsubsecskip}{-12pt}
\renewcommand{\cftsecfont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecfont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecfont}{\fontseries{md}\fontsize{10}{12}\selectfont}
\renewcommand{\cftsecpagefont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecpagefont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecpagefont}{\fontseries{md}\fontsize{10}{12}\selectfont}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\LARGE\bfseries}{\chaptertitlename\ \thechapter}{15mm}{\LARGE}
\titlespacing*{\chapter}{0mm}{50mm}{15mm}
\titlespacing*{\section}{0pt}{15mm}{15mm}
\titlespacing*{\subsection}{0pt}{15mm}{15mm}
\titlespacing*{\subsubsection}{0pt}{10mm}{10mm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{Chapter\space{\thechapter,\space\space}Section\space{\thesection}}
\fancyhead[RO]{\thepage}
\fancyhead[LO]{\nouppercase\rightmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
答案1
我最近做了类似的事情。我没有在序言中定义页眉和页脚,而是转到文档设置 > 模块并启用“自定义页眉/页脚”。这将在下拉菜单中添加 6 种新布局(见图)。
有了这个和一些 TeX 框,你就可以实现你想要的。我不确定如何在这里最好地展示它 - 也许只需将此代码复制到编辑器,将其保存为文件.lyx
,然后在 LyX 中打开它。我试图解释那里的所有内容:
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass extarticle
\begin_preamble
\pagestyle{fancy}
\end_preamble
\use_default_options false
\begin_modules
customHeadersFooters
\end_modules
\maintain_unincluded_children false
\language american
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "times" "Times New Roman"
\font_sans "helvet" "Arial"
\font_typewriter "courier" "Courier New"
\font_math "auto" "default"
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing onehalf
\use_hyperref true
\pdf_title "Blah"
\pdf_author "Ginchen"
\pdf_keywords "blah, blah, blah"
\pdf_bookmarks true
\pdf_bookmarksnumbered true
\pdf_bookmarksopen true
\pdf_bookmarksopenlevel 2
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks true
\pdf_backref page
\pdf_pdfusetitle false
\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
\papersize a4paper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 0
\use_package esint 0
\use_package mathdots 1
\use_package mathtools 0
\use_package mhchem 1
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\leftmargin 2.5cm
\topmargin 2.5cm
\rightmargin 2.5cm
\bottommargin 2cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip bigskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\bullet 1 0 9 -1
\bullet 2 1 35 -1
\bullet 3 1 29 -1
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Center Footer
This is my footer that appears on all pages starting from page 1!
\end_layout
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Plain Layout
The following headers are set to empty, because otherwise the table of contents
gets an ugly
\begin_inset Quotes eld
\end_inset
CONTENTS - CONTENTS
\begin_inset Quotes erd
\end_inset
header.
\end_layout
\end_inset
\end_layout
\begin_layout Left Header
\end_layout
\begin_layout Center Header
\end_layout
\begin_layout Right Header
\end_layout
\begin_layout Title
Title
\end_layout
\begin_layout Author
Author
\end_layout
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Plain Layout
The title page usually uses the plain layout, which includes a page number
in the footer instead of the footer defined above.
So we set the page style to fancy for this page.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
thispagestyle{fancy}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Plain Layout
Although the header is empty, the line beneath it will still display.
\begin_inset Newline newline
\end_inset
So we remove it by making it 0pt high.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
renewcommand{
\backslash
headrulewidth}{0pt}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Newpage newpage
\end_inset
\end_layout
\begin_layout Abstract
blah blah blah
\end_layout
\begin_layout Standard
\begin_inset Newpage newpage
\end_inset
\end_layout
\begin_layout Standard
\begin_inset CommandInset toc
LatexCommand tableofcontents
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Newpage newpage
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Plain Layout
The following headers will be shown starting from this point.
\end_layout
\end_inset
\end_layout
\begin_layout Left Header
\noindent
This is the header that will only begin to appear after all the front matter
\end_layout
\begin_layout Right Header
Page
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
thepage
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Plain Layout
If you want the line beneath the header back, you can set it back to 1pt:
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
renewcommand{
\backslash
headrulewidth}{1pt}
\end_layout
\end_inset
\end_layout
\begin_layout Part
Once upon a time...
\end_layout
\begin_layout Standard
...
there was a question in the TeX StackExchange, and the princess of LyX
wrote a meaningless text just for the sake of an example.
\end_layout
\end_body
\end_document