使用 titlesec 和词汇表的词汇表部分中的标题问题

使用 titlesec 和词汇表的词汇表部分中的标题问题

我正在用乳胶撰写论文,并且在词汇表部分遇到了标题问题。

我使用 titlesec 修改了标题,并使用词汇表包保留了一个缩写列表。

我在这里提供了我的问题的 MWE。基本上,我希望偶数页显示页码,奇数页显示词汇表的页码和部分名称。这在我的文档的其余部分中运行良好,但词汇表部分有所不同。另外,我希望词汇表后的空白页中的页眉仅为页码。

\documentclass[
    openright,
    twoside,
    12pt]
    {report}

   \usepackage[
    paperwidth=16cm,
    paperheight=24cm]
    {geometry} 

\linespread{1.5}

\usepackage[
acronym,
nomain,
nonumberlist]
{glossaries} %for list of abbreviations

\usepackage[
    pagestyles] %option allow to change page header (remove "chapter" from header)
    {titlesec}
\titleformat{\chapter}{\normalfont\huge}{\bf\thechapter.}{20pt}{\huge\bf} %change chapter N to N. chapter title
\newpagestyle{mystyle} %page style for whole document
{\sethead[\thepage][][\thechapter .~\chaptertitle]{\thesection~\sectiontitle}{}{\thepage}
}
\newpagestyle{bibstyle} %page style for bibliography
{\sethead[\thepage][][\thechapter .~\chaptertitle]{}{}{\thepage}
}
\newpagestyle{content} %page style for forewords sections
{\sethead[\thepage][][]{\chaptertitle}{}{\thepage}
}

\usepackage{lipsum}

\newacronym {eeg} {EEG} {Electroencephalogram}
\newacronym {cam} {CAM} {Counting Arm Movement}
\newacronym {anova} {ANOVA} {Analysis Of Variance}
\newacronym {bci} {BCI} {Brain-Computer Interface}
\newacronym {ecam} {eCAM} {electronic Counting Arm Movement}
\newacronym {fes} {FES} {Functional Electrical Stimulation}
\newacronym {bb} {BB} {Biceps Brachii}
\newacronym {tb} {TB} {Triceps Brachii}
\newacronym {fcr} {FCR} {Flexor Carpi Radialis}
\newacronym {ecr} {ECR} {Extensor Carpi Radialis}
\newacronym {st} {ST} {Sensory Threshold}
\newacronym {vas} {VAS} {Visual Analog Scale}
\newacronym {cns} {CNS} {Central Nervous System}
\newacronym {tms} {TMS} {Transcranial Magnetic Stimulation}
\newacronym {tdcs} {tDCS} {transcranial Direct Current Stimulation}
\newacronym {cbi} {CBI} {Cerebellum-Brain Inhibition}
\newacronym {atdcs} {atDCS} {anodal tDCS}
\newacronym {ctdcs} {ctDCS} {cathodal tDCS}
\newacronym {emg} {EMG} {Electromyogram}
\newacronym {fft} {FFT} {Fast Fourier Transform}
\newacronym {psd} {PSD} {Power Spectral Density}
\newacronym {pse} {PSE} {Power Spectral Entropy}
\newacronym {kld} {KLD} {Kullback-Leibler Divergence}
\newacronym {lc} {LC} {Laterality Coefficient}
\newacronym {snk} {SNK} {Student-Newman-Keuls}
\newacronym {tccdcs} {tCCDCS} {transcranial Cerebello-Cerebral Direct Current Stimulation}
\newacronym {icc} {ICC} {Intra-Class Coefficient}
\newacronym {cv} {CV} {Coefficient of Variation}
\newacronym {csf} {CSF} {Cerebrospinal Fluid}
\newacronym {nmda} {NMDA} {N-methyl-D-aspartate}
\newacronym {bmi} {BMI} {Brain-Machine Interface}
\newacronym {ecog} {ECoG} {Electrocorticogram}
\newacronym {meg} {MEG} {Magnetoencephalogram}
\newacronym {pet} {PET} {Positron Emission Tomography}
\newacronym {fmri} {fMRI} {functional Magnetic Resonance Imaging}
\newacronym {erd} {ERD} {Event-Related Desynchronization}
\newacronym {ers} {ERS} {Event-Related Synchronization}

\makeglossaries

\begin{document}
\pagestyle{content}

\printglossary[title = List of abbreviations]


\pagestyle{mystyle}
\chapter {First Chapter}

\glsaddall 
\lipsum[1-1]
\lipsum[2-2]

\end{document}

这是最终的文档(我用红色和蓝色标记了我想要更改的内容):

第一个词汇表页面很好 第二个词汇表页面也很好 缺少第三个词汇表页眉 空白页标题错误 剩余文件没有问题

答案1

缺少\cleardoublepage页面样式的改变。因此,mystyle词汇表的最后一页启用了页面样式。

\cleardoublepage% <- added
\pagestyle{mystyle}

或者您必须按照@Schweinebacke 在评论中的建议移动到\pagestyle{mystyle}后面/下面。\chapter{First Chapter}

在此处输入图片描述

在此处输入图片描述

\documentclass[
    openright,
    twoside,
    12pt]
    {report}

   \usepackage[
    paperwidth=16cm,
    paperheight=24cm]
    {geometry} 

\linespread{1.5}

\usepackage[
acronym,
nomain,
nonumberlist]
{glossaries} %for list of abbreviations

\usepackage[
    pagestyles] %option allow to change page header (remove "chapter" from header)
    {titlesec}
\titleformat{\chapter}{\normalfont\huge}{\bf\thechapter.}{20pt}{\huge\bf} %change chapter N to N. chapter title
\newpagestyle{mystyle} %page style for whole document
{\sethead[\thepage][][\thechapter .~\chaptertitle]{\thesection~\sectiontitle}{}{\thepage}
}
\newpagestyle{bibstyle} %page style for bibliography
{\sethead[\thepage][][\thechapter .~\chaptertitle]{}{}{\thepage}
}
\newpagestyle{content} %page style for forewords sections
{\sethead[\thepage][][]{\chaptertitle}{}{\thepage}
}

\usepackage{lipsum}

\newacronym {eeg} {EEG} {Electroencephalogram}
\newacronym {cam} {CAM} {Counting Arm Movement}
\newacronym {anova} {ANOVA} {Analysis Of Variance}
\newacronym {bci} {BCI} {Brain-Computer Interface}
\newacronym {ecam} {eCAM} {electronic Counting Arm Movement}
\newacronym {fes} {FES} {Functional Electrical Stimulation}
\newacronym {bb} {BB} {Biceps Brachii}
\newacronym {tb} {TB} {Triceps Brachii}
\newacronym {fcr} {FCR} {Flexor Carpi Radialis}
\newacronym {ecr} {ECR} {Extensor Carpi Radialis}
\newacronym {st} {ST} {Sensory Threshold}
\newacronym {vas} {VAS} {Visual Analog Scale}
\newacronym {cns} {CNS} {Central Nervous System}
\newacronym {tms} {TMS} {Transcranial Magnetic Stimulation}
\newacronym {tdcs} {tDCS} {transcranial Direct Current Stimulation}
\newacronym {cbi} {CBI} {Cerebellum-Brain Inhibition}
\newacronym {atdcs} {atDCS} {anodal tDCS}
\newacronym {ctdcs} {ctDCS} {cathodal tDCS}
\newacronym {emg} {EMG} {Electromyogram}
\newacronym {fft} {FFT} {Fast Fourier Transform}
\newacronym {psd} {PSD} {Power Spectral Density}
\newacronym {pse} {PSE} {Power Spectral Entropy}
\newacronym {kld} {KLD} {Kullback-Leibler Divergence}
\newacronym {lc} {LC} {Laterality Coefficient}
\newacronym {snk} {SNK} {Student-Newman-Keuls}
\newacronym {tccdcs} {tCCDCS} {transcranial Cerebello-Cerebral Direct Current Stimulation}
\newacronym {icc} {ICC} {Intra-Class Coefficient}
\newacronym {cv} {CV} {Coefficient of Variation}
\newacronym {csf} {CSF} {Cerebrospinal Fluid}
\newacronym {nmda} {NMDA} {N-methyl-D-aspartate}
\newacronym {bmi} {BMI} {Brain-Machine Interface}
\newacronym {ecog} {ECoG} {Electrocorticogram}
\newacronym {meg} {MEG} {Magnetoencephalogram}
\newacronym {pet} {PET} {Positron Emission Tomography}
\newacronym {fmri} {fMRI} {functional Magnetic Resonance Imaging}
\newacronym {erd} {ERD} {Event-Related Desynchronization}
\newacronym {ers} {ERS} {Event-Related Synchronization}

\makeglossaries

\begin{document}
\pagestyle{content}
\printglossary[title = List of abbreviations]

\pagestyle{mystyle}
\chapter {First Chapter}
\pagestyle{mystyle}% <- moved behind the \chapter command
\glsaddall 
\lipsum[1-1]
\lipsum[2-2]
\end{document}

相关内容