사전에 \markbo{}{}를 사용하여 잘못된 헤더 참조

사전에 \markbo{}{}를 사용하여 잘못된 헤더 참조

내 사전에 대한 사전 템플릿을 구현하려고 하는데 헤더를 올바르게 가져오는 데 어려움을 겪고 있습니다.

많은 사전에서 헤더에는 페이지의 첫 번째 항목과 마지막 항목이 포함됩니다. 라텍스에서는 예를 들어 \markboth 및 fancyhdr을 사용하여 구현할 수 있습니다.

\markboth를 사용할 때 문제는 페이지의 마지막 문단(=한 항목)이 페이지를 끝낼 때 해당 페이지와 다음 페이지의 헤더가 올바른 항목을 참조하지 않는다는 것입니다. 다음 페이지를 시작하는 단락은 헤더에서 이전 페이지의 마지막 항목이 되고, 다음 페이지의 두 번째 단락은 다음 페이지 헤더의 첫 번째 항목으로 나타납니다.

l 페이지의 마지막 단락 x가 페이지를 끝내지 않으면 => 문제 없음

else if 페이지 l의 마지막 단락 x가 페이지를 끝내는 경우 => 페이지 l 헤더의 마지막 항목이 단락 x+1(페이지 l+1)을 표시하고 페이지 l+1 헤더의 첫 번째 항목이 단락 x+2를 표시합니다.

아래에는 인터넷에서 널리 사용할 수 있는 사전 템플릿의 코드가 표시되어 있으며 문제를 가시화하기 위해 더 많은 항목을 추가했습니다. 특히 항목이 페이지를 끝내는 페이지를 살펴보세요.

분명히 예를 들어 페이지의 마지막 단락에 \vfill을 추가하면 관련 페이지의 문제가 해결되지만 자동화된 방식으로 이 문제를 해결할 수 있기를 바랍니다.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
% Dictionary    
% LaTeX Template    
% Version 1.0 (20/12/14)    
%    
% This template has been downloaded from:    
% http://www.LaTeXTemplates.com    
%    
% Original author:    
% Vel ([email protected]) inspired by a template by Marc Lavaud    
%    
% License:    
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)    
%    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    

%----------------------------------------------------------------------------------------    
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS    
%----------------------------------------------------------------------------------------    

\documentclass[10pt,a4paper,twoside]{article} % 10pt font size, A4 paper and two-sided margins    

\usepackage[top=3.5cm,bottom=3.5cm,left=3.7cm,right=4.7cm,columnsep=30pt]{geometry} % Document margins and spacings    

\usepackage[utf8]{inputenc} % Required for inputting international characters    
\usepackage[T1]{fontenc} % Output font encoding for international characters    

\usepackage{palatino} % Use the Palatino font    

\usepackage{microtype} % Improves spacing    

\usepackage{multicol} % Required for splitting text into multiple columns    

\usepackage[bf,sf,center]{titlesec} % Required for modifying section titles - bold, sans-serif, centered    

\usepackage{fancyhdr} % Required for modifying headers and footers    
\fancyhead[L]{\textsf{\rightmark}} % Top left header    
\fancyhead[R]{\textsf{\leftmark}} % Top right header    
\renewcommand{\headrulewidth}{1.4pt} % Rule under the header    
\fancyfoot[C]{\textbf{\textsf{\thepage}}} % Bottom center footer    
\renewcommand{\footrulewidth}{1.4pt} % Rule under the footer    
\pagestyle{fancy} % Use the custom headers and footers throughout the document    

\newcommand{\entry}[4]{\markboth{#1}{#1}\textbf{#1}\ {(#2)}\ \textit{#3}\ $\bullet$\ {#4}}  % Defines the command to print each word on the page, \markboth{}{} prints the first word on the page in the top left header and the last word in the top right    

%----------------------------------------------------------------------------------------    

\begin{document}    

%----------------------------------------------------------------------------------------    
%   SECTION A    
%----------------------------------------------------------------------------------------    

\section*{A}    

\begin{multicols}{2}    

\entry{Aardvark}{ahrd-vahrk}{Noun}{A nocturnal badger-sized burrowing mammal of Africa, with long ears, a tubular snout, and a long extensible tongue, feeding on ants and termites. Also called antbear.}    

\entry{Abbreviated}{uh-bree-vee-ey-tid}{Adjective}{Constituting a shorter or smaller version of}    

\entry{Aberration}{ab-uh-rey-shuh n}{Noun}{The act of deviating from the ordinary, usual, or normal type.}    

\entry{Above}{uh-buhv}{Preposition}{In extended space over and not touching.}    

\entry{Academia}{ak-uh-dee-mee-uh}{Noun}{The environment or community concerned with the pursuit of research, education, and scholarship.}    

\entry{Accomplished}{uh-kom-plisht}{Adjective}{Completed; done; effected. Highly trained or skilled in a particular activity.}    

\entry{Acidophilic}{uh-sid-uh-fil-ik, as-i-duh-}{Adjective}{Biology: having an affinity for acid stains; eosinophilic. Ecology: thriving in or requiring an acid environment.}    

\entry{Adaptation}{ad-uh p-tey-shuh n}{Noun}{The action or process of adapting or being adapted. Biology: The process of change by which an organism or species becomes better suited to its environment}    

\entry{Adenine}{ad-n-in, -een, -ahyn}{Noun}{A compound which is one of the four constituent bases of nucleic acids. A purine derivative, it is paired with thymine in double-stranded DNA.}    

\entry{Adorable}{uh-dawr-uh-buh l}{Adjective}{Inspiring great affection or delight.}    

\entry{Advanced}{ad-vanst}{Adjective}{Far on or ahead in development or progress.}    

\entry{Aerial}{air-ee-uh l}{Noun}{A rod, wire, or other structure by which signals are transmitted or received as part of a radio or television transmission or receiving system.}    

\entry{Affordable}{uh-fawr-duh-buh l}{Adjective}{Believed to be within one's financial means.}    

\entry{Agnostic}{ag-nos-tik}{Noun}{A person who holds that the existence of the ultimate cause, as God, and the essential nature of things are unknown and unknowable, or that human knowledge is limited to experience.}    

\entry{Aioli}{ahy-oh-lee}{Noun}{Mayonnaise seasoned with garlic.}    

\entry{Alchemy}{al-kuh-mee}{Noun}{The medieval forerunner of chemistry, concerned with the transmutation of matter, in particular with attempts to convert base metals into gold or find a universal elixir.}    

\entry{Algebra}{al-juh-bruh}{Noun}{The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations.}    

\entry{Amatol}{am-uh-tawl}{Noun}{A high explosive consisting of a mixture of TNT and ammonium nitrate.}    

\entry{Almanac}{awl-muh-nak}{Noun}{An annual publication containing a calendar for the coming year, the times of such events and phenomena}    

\entry{Animal}{an-uh-muh l}{Noun}{A living organism which feeds on organic matter, typically having specialized sense organs and nervous system and able to respond rapidly to stimuli.}    

\entry{Ascension}{auh-sen-shuh n}{Noun}{The action of rising to an important position or a higher level.}    

\entry{Aspire}{uh-spahyuh r}{Verb}{Direct one's hopes or ambitions towards achieving something.}    

\entry{Athlete}{ath-leet}{Noun}{a person trained or gifted in exercises or contests involving physical agility, stamina, or strength; a participant in a sport, exercise, or game requiring physical skill.}    

\entry{Azobenzene}{az-oh-ben-zeen}{Noun}{A synthetic crystalline organic compound used chiefly in dye manufacture.}    

\entry{Aardvark}{ahrd-vahrk}{Noun}{A nocturnal badger-sized burrowing mammal of Africa, with long ears, a tubular snout, and a long extensible tongue, feeding on ants and termites. Also called antbear.}    

\entry{Abbreviated}{uh-bree-vee-ey-tid}{Adjective}{Constituting a shorter or smaller version of}    

\entry{Aberration}{ab-uh-rey-shuh n}{Noun}{The act of deviating from the ordinary, usual, or normal type.}    

\entry{Above}{uh-buhv}{Preposition}{In extended space over and not touching.}    

\entry{Academia}{ak-uh-dee-mee-uh}{Noun}{The environment or community concerned with the pursuit of research, education, and scholarship.}    

\entry{Accomplished}{uh-kom-plisht}{Adjective}{Completed; done; effected. Highly trained or skilled in a particular activity.}    

\entry{Acidophilic}{uh-sid-uh-fil-ik, as-i-duh-}{Adjective}{Biology: having an affinity for acid stains; eosinophilic. Ecology: thriving in or requiring an acid environment.}    

\entry{Adaptation}{ad-uh p-tey-shuh n}{Noun}{The action or process of adapting or being adapted. Biology: The process of change by which an organism or species becomes better suited to its environment}    

\entry{Adenine}{ad-n-in, -een, -ahyn}{Noun}{A compound which is one of the four constituent bases of nucleic acids. A purine derivative, it is paired with thymine in double-stranded DNA.}    

\entry{Adorable}{uh-dawr-uh-buh l}{Adjective}{Inspiring great affection or delight.}    

\entry{Advanced}{ad-vanst}{Adjective}{Far on or ahead in development or progress.}    

\entry{Aerial}{air-ee-uh l}{Noun}{A rod, wire, or other structure by which signals are transmitted or received as part of a radio or television transmission or receiving system.}    

\entry{Affordable}{uh-fawr-duh-buh l}{Adjective}{Believed to be within one's financial means.}    

\entry{Agnostic}{ag-nos-tik}{Noun}{A person who holds that the existence of the ultimate cause, as God, and the essential nature of things are unknown and unknowable, or that human knowledge is limited to experience.}    

\entry{Aioli}{ahy-oh-lee}{Noun}{Mayonnaise seasoned with garlic.}    

\entry{Alchemy}{al-kuh-mee}{Noun}{The medieval forerunner of chemistry, concerned with the transmutation of matter, in particular with attempts to convert base metals into gold or find a universal elixir.}    

\entry{Algebra}{al-juh-bruh}{Noun}{The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations.}    

\entry{Amatol}{am-uh-tawl}{Noun}{A high explosive consisting of a mixture of TNT and ammonium nitrate.}    

\entry{Almanac}{awl-muh-nak}{Noun}{An annual publication containing a calendar for the coming year, the times of such events and phenomena}    

\entry{Animal}{an-uh-muh l}{Noun}{A living organism which feeds on organic matter, typically having specialized sense organs and nervous system and able to respond rapidly to stimuli.}    

\entry{Ascension}{auh-sen-shuh n}{Noun}{The action of rising to an important position or a higher level.}    

\entry{Aspire}{uh-spahyuh r}{Verb}{Direct one's hopes or ambitions towards achieving something.}    

\entry{Athlete}{ath-leet}{Noun}{a person trained or gifted in exercises or contests involving physical agility, stamina, or strength; a participant in a sport, exercise, or game requiring physical skill.}    

\entry{Azobenzene}{az-oh-ben-zeen}{Noun}{A synthetic crystalline organic compound used chiefly in dye manufacture.}    

\entry{Aardvark}{ahrd-vahrk}{Noun}{A nocturnal badger-sized burrowing mammal of Africa, with long ears, a tubular snout, and a long extensible tongue, feeding on ants and termites. Also called antbear.}    

\entry{Abbreviated}{uh-bree-vee-ey-tid}{Adjective}{Constituting a shorter or smaller version of}    

\entry{Aberration}{ab-uh-rey-shuh n}{Noun}{The act of deviating from the ordinary, usual, or normal type.}    

\entry{Above}{uh-buhv}{Preposition}{In extended space over and not touching.}    

\entry{Academia}{ak-uh-dee-mee-uh}{Noun}{The environment or community concerned with the pursuit of research, education, and scholarship.}    

\entry{Accomplished}{uh-kom-plisht}{Adjective}{Completed; done; effected. Highly trained or skilled in a particular activity.}    

\entry{Acidophilic}{uh-sid-uh-fil-ik, as-i-duh-}{Adjective}{Biology: having an affinity for acid stains; eosinophilic. Ecology: thriving in or requiring an acid environment.}    

\entry{Adaptation}{ad-uh p-tey-shuh n}{Noun}{The action or process of adapting or being adapted. Biology: The process of change by which an organism or species becomes better suited to its environment}    

\entry{Adenine}{ad-n-in, -een, -ahyn}{Noun}{A compound which is one of the four constituent bases of nucleic acids. A purine derivative, it is paired with thymine in double-stranded DNA.}    

\entry{Adorable}{uh-dawr-uh-buh l}{Adjective}{Inspiring great affection or delight.}    

\entry{Advanced}{ad-vanst}{Adjective}{Far on or ahead in development or progress.}    

\entry{Aerial}{air-ee-uh l}{Noun}{A rod, wire, or other structure by which signals are transmitted or received as part of a radio or television transmission or receiving system.}    

\entry{Affordable}{uh-fawr-duh-buh l}{Adjective}{Believed to be within one's financial means.}    

\entry{Agnostic}{ag-nos-tik}{Noun}{A person who holds that the existence of the ultimate cause, as God, and the essential nature of things are unknown and unknowable, or that human knowledge is limited to experience.}    

\entry{Aioli}{ahy-oh-lee}{Noun}{Mayonnaise seasoned with garlic.}    

\entry{Alchemy}{al-kuh-mee}{Noun}{The medieval forerunner of chemistry, concerned with the transmutation of matter, in particular with attempts to convert base metals into gold or find a universal elixir.}    

\entry{Algebra}{al-juh-bruh}{Noun}{The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations.}    

\entry{Amatol}{am-uh-tawl}{Noun}{A high explosive consisting of a mixture of TNT and ammonium nitrate.}    

\entry{Almanac}{awl-muh-nak}{Noun}{An annual publication containing a calendar for the coming year, the times of such events and phenomena}    

\entry{Animal}{an-uh-muh l}{Noun}{A living organism which feeds on organic matter, typically having specialized sense organs and nervous system and able to respond rapidly to stimuli.}    

\entry{Ascension}{auh-sen-shuh n}{Noun}{The action of rising to an important position or a higher level.}    

\entry{Aspire}{uh-spahyuh r}{Verb}{Direct one's hopes or ambitions towards achieving something.}    

\entry{Athlete}{ath-leet}{Noun}{a person trained or gifted in exercises or contests involving physical agility, stamina, or strength; a participant in a sport, exercise, or game requiring physical skill.}    

\entry{Azobenzene}{az-oh-ben-zeen}{Noun}{A synthetic crystalline organic compound used chiefly in dye manufacture.}    

\entry{Aardvark}{ahrd-vahrk}{Noun}{A nocturnal badger-sized burrowing mammal of Africa, with long ears, a tubular snout, and a long extensible tongue, feeding on ants and termites. Also called antbear.}    

\entry{Abbreviated}{uh-bree-vee-ey-tid}{Adjective}{Constituting a shorter or smaller version of}    

\entry{Aberration}{ab-uh-rey-shuh n}{Noun}{The act of deviating from the ordinary, usual, or normal type.}    

\entry{Above}{uh-buhv}{Preposition}{In extended space over and not touching.}    

\entry{Academia}{ak-uh-dee-mee-uh}{Noun}{The environment or community concerned with the pursuit of research, education, and scholarship.}    

\entry{Accomplished}{uh-kom-plisht}{Adjective}{Completed; done; effected. Highly trained or skilled in a particular activity.}    

\entry{Acidophilic}{uh-sid-uh-fil-ik, as-i-duh-}{Adjective}{Biology: having an affinity for acid stains; eosinophilic. Ecology: thriving in or requiring an acid environment.}    

\entry{Adaptation}{ad-uh p-tey-shuh n}{Noun}{The action or process of adapting or being adapted. Biology: The process of change by which an organism or species becomes better suited to its environment}    

\entry{Adenine}{ad-n-in, -een, -ahyn}{Noun}{A compound which is one of the four constituent bases of nucleic acids. A purine derivative, it is paired with thymine in double-stranded DNA.}    

\entry{Adorable}{uh-dawr-uh-buh l}{Adjective}{Inspiring great affection or delight.}    

\entry{Advanced}{ad-vanst}{Adjective}{Far on or ahead in development or progress.}    

\entry{Aerial}{air-ee-uh l}{Noun}{A rod, wire, or other structure by which signals are transmitted or received as part of a radio or television transmission or receiving system.}    

\entry{Affordable}{uh-fawr-duh-buh l}{Adjective}{Believed to be within one's financial means.}    

\entry{Agnostic}{ag-nos-tik}{Noun}{A person who holds that the existence of the ultimate cause, as God, and the essential nature of things are unknown and unknowable, or that human knowledge is limited to experience.}    

\entry{Aioli}{ahy-oh-lee}{Noun}{Mayonnaise seasoned with garlic.}    

\entry{Alchemy}{al-kuh-mee}{Noun}{The medieval forerunner of chemistry, concerned with the transmutation of matter, in particular with attempts to convert base metals into gold or find a universal elixir.}    

\entry{Algebra}{al-juh-bruh}{Noun}{The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations.}    

\entry{Amatol}{am-uh-tawl}{Noun}{A high explosive consisting of a mixture of TNT and ammonium nitrate.}    

\entry{Almanac}{awl-muh-nak}{Noun}{An annual publication containing a calendar for the coming year, the times of such events and phenomena}    

\entry{Animal}{an-uh-muh l}{Noun}{A living organism which feeds on organic matter, typically having specialized sense organs and nervous system and able to respond rapidly to stimuli.}    

\entry{Ascension}{auh-sen-shuh n}{Noun}{The action of rising to an important position or a higher level.}    

\entry{Aspire}{uh-spahyuh r}{Verb}{Direct one's hopes or ambitions towards achieving something.}    

\entry{Athlete}{ath-leet}{Noun}{a person trained or gifted in exercises or contests involving physical agility, stamina, or strength; a participant in a sport, exercise, or game requiring physical skill.}    

\entry{Azobenzene}{az-oh-ben-zeen}{Noun}{A synthetic crystalline organic compound used chiefly in dye manufacture.}    

\entry{Aardvark}{ahrd-vahrk}{Noun}{A nocturnal badger-sized burrowing mammal of Africa, with long ears, a tubular snout, and a long extensible tongue, feeding on ants and termites. Also called antbear.}    

\entry{Abbreviated}{uh-bree-vee-ey-tid}{Adjective}{Constituting a shorter or smaller version of}    

\entry{Aberration}{ab-uh-rey-shuh n}{Noun}{The act of deviating from the ordinary, usual, or normal type.}    

\entry{Above}{uh-buhv}{Preposition}{In extended space over and not touching.}    

\entry{Academia}{ak-uh-dee-mee-uh}{Noun}{The environment or community concerned with the pursuit of research, education, and scholarship.}    

\entry{Accomplished}{uh-kom-plisht}{Adjective}{Completed; done; effected. Highly trained or skilled in a particular activity.}    

\entry{Acidophilic}{uh-sid-uh-fil-ik, as-i-duh-}{Adjective}{Biology: having an affinity for acid stains; eosinophilic. Ecology: thriving in or requiring an acid environment.}    

\entry{Adaptation}{ad-uh p-tey-shuh n}{Noun}{The action or process of adapting or being adapted. Biology: The process of change by which an organism or species becomes better suited to its environment}    

\entry{Adenine}{ad-n-in, -een, -ahyn}{Noun}{A compound which is one of the four constituent bases of nucleic acids. A purine derivative, it is paired with thymine in double-stranded DNA.}    

\entry{Adorable}{uh-dawr-uh-buh l}{Adjective}{Inspiring great affection or delight.}    

\entry{Advanced}{ad-vanst}{Adjective}{Far on or ahead in development or progress.}    

\entry{Aerial}{air-ee-uh l}{Noun}{A rod, wire, or other structure by which signals are transmitted or received as part of a radio or television transmission or receiving system.}    

\entry{Affordable}{uh-fawr-duh-buh l}{Adjective}{Believed to be within one's financial means.}    

\entry{Agnostic}{ag-nos-tik}{Noun}{A person who holds that the existence of the ultimate cause, as God, and the essential nature of things are unknown and unknowable, or that human knowledge is limited to experience.}    

\entry{Aioli}{ahy-oh-lee}{Noun}{Mayonnaise seasoned with garlic.}    

\entry{Alchemy}{al-kuh-mee}{Noun}{The medieval forerunner of chemistry, concerned with the transmutation of matter, in particular with attempts to convert base metals into gold or find a universal elixir.}    

\entry{Algebra}{al-juh-bruh}{Noun}{The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations.}    

\entry{Amatol}{am-uh-tawl}{Noun}{A high explosive consisting of a mixture of TNT and ammonium nitrate.}    

\entry{Almanac}{awl-muh-nak}{Noun}{An annual publication containing a calendar for the coming year, the times of such events and phenomena}    

\entry{Animal}{an-uh-muh l}{Noun}{A living organism which feeds on organic matter, typically having specialized sense organs and nervous system and able to respond rapidly to stimuli.}    

\entry{Ascension}{auh-sen-shuh n}{Noun}{The action of rising to an important position or a higher level.}    

\entry{Aspire}{uh-spahyuh r}{Verb}{Direct one's hopes or ambitions towards achieving something.}    

\entry{Athlete}{ath-leet}{Noun}{a person trained or gifted in exercises or contests involving physical agility, stamina, or strength; a participant in a sport, exercise, or game requiring physical skill.}    

\entry{Azobenzene}{az-oh-ben-zeen}{Noun}{A synthetic crystalline organic compound used chiefly in dye manufacture.}    


\end{multicols}    
\end{document}

답변1

\markbot 앞에 단락을 시작하는 것이 나에게는 잘 작동합니다. 와 함께

  \newcommand{\entry}[4]{\leavevmode\markboth{#1}{#1}\textbf{#1}\ {(#2)}\ \textit{#3}\ $\bullet$\ {#4}}

이제 4페이지는 다음과 같습니다. 여기에 이미지 설명을 입력하세요

이것을 받기 전: 여기에 이미지 설명을 입력하세요

관련 정보