我知道可以使用各种包来定制标题;其中最重要的是 fancyhdr。
在我的文档索引中,我希望索引的当前“主题”显示在标题中。这类似于在文档正文的标题中显示当前章节。
有人可以告诉我怎么做吗?
答案1
这将帮助你入门
步骤 1:您需要一个索引样式文件 - 将其放在与您的 tex 文件相同的文件夹中,但您可以指定它放在其他地方
将文件命名为(本例中)index_xstyle.ist
headings_flag 1
heading_prefix "{\\large\\sffamily\\bfseries "
heading_suffix "}\\nopagebreak\n"
delim_0 "} \\dotfill " % Provide right brace for level_0 items when they have page number:
delim_1 " \\dotfill "
delim_2 " \\dotfill "
item_x1 "} \n \\subitem " % Provide the right brace for level_0 items when they have no page number:
item_0 "\n \\item \\indexmark{"%added this with its usual default to mark it up
第 2 步:尝试此 mwe
如果使用 imakeidx 的其他功能(例如拆分索引),则使用 --shell-escape 进行编译
\documentclass[a4paper]{article}
\usepackage{imakeidx}
\usepackage{fancyhdr}
\usepackage{hyperref}
%You need to make an index style
\fancypagestyle{index}{%
\fancyhead{}
\fancyhead[RO,LE]{\rightmark -- \leftmark}
}
%You need a macro to use in your index style file to collect the index marks
\newcommand{\indexmark}[1]{#1\markboth{#1}{#1}}
%Set up your index (say to use your style on page 1 of index too if desired)
\indexsetup{level=\section*,toclevel=section,firstpagestyle=index}
%You need to tell it to use your style file
\makeindex[columns=2,title=Main index,intoc,options={-s index_xstyle.ist},]
\begin{document}
%Lots of index entries
Aachen\index{Aachen} aardvark\index{aardvark} aargh\index{aargh} Aarhus\index{Aarhus} Aaron\index{Aaron} Aaronvitch\index{Aaronvitch} Ababa\index{Ababa} aback\index{aback} abacus\index{abacus} abaft\index{abaft} abalone\index{abalone} abandon\index{abandon} abandoner\index{abandoner} abase\index{abase} abaser\index{abaser} abash\index{abash} abashed\index{abashed} abate\index{abate} abated\index{abated} abater\index{abater} abattoir\index{abattoir} Abba\index{Abba} abbess\index{abbess} abbey\index{abbey} abbot\index{abbot} Abbott\index{Abbott} abbreviate\index{abbreviate} abbreviated\index{abbreviated} abbreviation\index{abbreviation} abbé\index{abbé} ABC\index{ABC} abdicate\index{abdicate} abdication\index{abdication} abdomen\index{abdomen} abdominal\index{abdominal} abduct\index{abduct} abductee\index{abductee} abduction\index{abduction} abductor\index{abductor} Abdul\index{Abdul} Abe\index{Abe} abeam\index{abeam} Abel\index{Abel} Abelard\index{Abelard} Abelson\index{Abelson} Aberconwy\index{Aberconwy} Aberdeen\index{Aberdeen} Aberdeenshire\index{Aberdeenshire} Abernathy\index{Abernathy} aberrant\index{aberrant} aberration\index{aberration} Aberystwyth\index{Aberystwyth} abet\index{abet} abettor\index{abettor} abeyance\index{abeyance} abeyant\index{abeyant} abhor\index{abhor} abhorrence\index{abhorrence} abhorrent\index{abhorrent} abhorrer\index{abhorrer} abidance\index{abidance} abide\index{abide} abider\index{abider} Abidjan\index{Abidjan} Abigail\index{Abigail} Abilene\index{Abilene} ability\index{ability} abiogenesis\index{abiogenesis} abiogenic\index{abiogenic} abiotic\index{abiotic} abject\index{abject} abjection\index{abjection} abjectness\index{abjectness} abjuration\index{abjuration} abjure\index{abjure} ablate\index{ablate} ablation\index{ablation} ablaze\index{ablaze} able-bodied\index{able-bodied} able\index{able} abler\index{abler} abloom\index{abloom} ablution\index{ablution} abnegate\index{abnegate} abnegation\index{abnegation} abnormal\index{abnormal} abnormality\index{abnormality} aboard\index{aboard} abode\index{abode} abolish\index{abolish} abolition\index{abolition} abolitionism\index{abolitionism} abolitionist\index{abolitionist} abominable\index{abominable} abominate\index{abominate} abomination\index{abomination} aboriginal\index{aboriginal} Aboriginals\index{Aboriginals} aborigine\index{aborigine} abort\index{abort} aborter\index{aborter} abortion\index{abortion} abortionist\index{abortionist} abortive\index{abortive} abound\index{abound} about\index{about} above\index{above} aboveboard\index{aboveboard} aboveground\index{aboveground} abracadabra\index{abracadabra} abrade\index{abrade} abrader\index{abrader} Abraham\index{Abraham} Abram\index{Abram} abrasion\index{abrasion} abrasive\index{abrasive} abrasiveness\index{abrasiveness} abreaction\index{abreaction} abreast\index{abreast} abridge\index{abridge} abridged\index{abridged} abridger\index{abridger} abroad\index{abroad} abrogate\index{abrogate} abrogation\index{abrogation} abrogator\index{abrogator} abrupt\index{abrupt} abruptness\index{abruptness} abs\index{abs} abscess\index{abscess} abscissa\index{abscissa} abscissae\index{abscissae} abscission\index{abscission} abscond\index{abscond} abseil\index{abseil} abseiler\index{abseiler} absence\index{absence} absent-minded\index{absent-minded} absent-mindedness\index{absent-mindedness} absent\index{absent} absentee\index{absentee} absenteeism\index{absenteeism} absenter\index{absenter} absentia\index{absentia} absinthe\index{absinthe} absolute\index{absolute} absoluteness\index{absoluteness} absolution\index{absolution} absolutism\index{absolutism} absolve\index{absolve} absolver\index{absolver} absorb\index{absorb} absorbed\index{absorbed} absorbency\index{absorbency} absorbent\index{absorbent} absorbs\index{absorbs} absorption\index{absorption} absorptivity\index{absorptivity} abstain\index{abstain} abstemious\index{abstemious} abstemiousness\index{abstemiousness} abstention\index{abstention} abstinence\index{abstinence} abstinent\index{abstinent} abstract\index{abstract} abstracted\index{abstracted} abstractedness\index{abstractedness} abstracter\index{abstracter} abstraction\index{abstraction} abstractionism\index{abstractionism} abstractionist\index{abstractionist} abstractness\index{abstractness} abstractor\index{abstractor} abstruse\index{abstruse} abstruseness\index{abstruseness} absurd\index{absurd} absurdity\index{absurdity} absurdness\index{absurdness} Abu\index{Abu} Abuja\index{Abuja} abundance\index{abundance} abundant\index{abundant} abusable\index{abusable} abuse\index{abuse} abuser\index{abuser} abusive\index{abusive} abusiveness\index{abusiveness} abut\index{abut} abuzz\index{abuzz} abysmal\index{abysmal} abyss\index{abyss} abyssal\index{abyssal} Abyssinia\index{Abyssinia} Abyssinian\index{Abyssinian} Ac\index{Ac} AC\index{AC} acacia\index{acacia} academe\index{academe} academia\index{academia} academic\index{academic} academician\index{academician} academicianship\index{academicianship} academy\index{academy} Acadia\index{Acadia} acanthus\index{acanthus} Acapulco\index{Acapulco} ACAS\index{ACAS} acc.\index{acc.} accede\index{accede} accelerate\index{accelerate} acceleration\index{acceleration} accelerator\index{accelerator} accelerometer\index{accelerometer} accent\index{accent} accented\index{accented} accentual\index{accentual} accentuate\index{accentuate} accentuation\index{accentuation} accept\index{accept} acceptability\index{acceptability} acceptable\index{acceptable} acceptableness\index{acceptableness} acceptably\index{acceptably} acceptance\index{acceptance} acceptant\index{acceptant} accepted\index{accepted} acceptingness\index{acceptingness} acceptor\index{acceptor} access\index{access} accessibility\index{accessibility} accessible\index{accessible} accessibly\index{accessibly} accession\index{accession} accessors\index{accessors} accessory\index{accessory} accidence\index{accidence} accident-prone\index{accident-prone} accident\index{accident} accidental\index{accidental} acclaim\index{acclaim} acclaimer\index{acclaimer} acclamation\index{acclamation} acclimate\index{acclimate} acclimation\index{acclimation} acclimatisation\index{acclimatisation} acclimatise\index{acclimatise} acclimatization\index{acclimatization} acclimatize\index{acclimatize} acclivity\index{acclivity} accolade\index{accolade} accommodate\index{accommodate} accommodating\index{accommodating} accommodation\index{accommodation} accommodative\index{accommodative} accompanied\index{accompanied} accompanier\index{accompanier} accompany\index{accompany} accomplice\index{accomplice} accomplish\index{accomplish} accomplished\index{accomplished} accord\index{accord} accordance\index{accordance} accordant\index{accordant} accordion\index{accordion} accordionist\index{accordionist} accost\index{accost} account\index{account} accountability's\index{accountability's} accountability\index{accountability} accountable\index{accountable} accountably\index{accountably} accountancy\index{accountancy} accountant\index{accountant} accounted\index{accounted} accounting\index{accounting} accoutre\index{accoutre} Accra\index{Accra} accredit\index{accredit} accreditation\index{accreditation} accredited\index{accredited} accreted\index{accreted} accretion\index{accretion} accretive\index{accretive} accrual\index{accrual} accrue\index{accrue} acct\index{acct} acculturate\index{acculturate} acculturation\index{acculturation} accumulate\index{accumulate} accumulation\index{accumulation} accumulative\index{accumulative} accumulator\index{accumulator} accuracy\index{accuracy} accurate\index{accurate} accurately\index{accurately} accurateness\index{accurateness} accursed\index{accursed} accursedness\index{accursedness} accusal\index{accusal} accusation\index{accusation} accusative\index{accusative} accusatory\index{accusatory} accuse\index{accuse} accused\index{accused} accustom\index{accustom} accustomed\index{accustomed} accustomedness\index{accustomedness} ace\index{ace} acellular\index{acellular} acer\index{acer} acerbate\index{acerbate} acerbic\index{acerbic} acerbity\index{acerbity} acetaminophen\index{acetaminophen} acetate\index{acetate} acetic\index{acetic} acetogenic\index{acetogenic} acetone\index{acetone} acetylcholine\index{acetylcholine} acetylene\index{acetylene} Achaean\index{Achaean} ache\index{ache} ached\index{ached} achene\index{achene} aches\index{aches} achievable\index{achievable} achieve\index{achieve} achieved\index{achieved} achievement's\index{achievement's} achievement\index{achievement} achievements\index{achievements} achiever\index{achiever} achieves\index{achieves} achieving\index{achieving} Achilles\index{Achilles} aching\index{aching} achromatic\index{achromatic} achy\index{achy} acid\index{acid} acidification\index{acidification} acidify\index{acidify} acidity\index{acidity} acidophil\index{acidophil} acidophiles\index{acidophiles} acidoses\index{acidoses} acidosis\index{acidosis} acidulous\index{acidulous} Ackerman\index{Ackerman} acknowledge\index{acknowledge} acknowledgeable\index{acknowledgeable} acknowledged\index{acknowledged} ACM\index{ACM} acme\index{acme} acne\index{acne} acolyte\index{acolyte} aconite\index{aconite} acorn\index{acorn} acoustic\index{acoustic} acoustical\index{acoustical} acoustician\index{acoustician} acoustics\index{acoustics} acquaint\index{acquaint} acquaintance\index{acquaintance} acquaintanceship\index{acquaintanceship} acquainted\index{acquainted} acquiesce\index{acquiesce} acquiescence\index{acquiescence} acquiescent\index{acquiescent} acquirable\index{acquirable} acquire\index{acquire} acquirement\index{acquirement} acquisition\index{acquisition} acquisitions\index{acquisitions} acquisitive\index{acquisitive} acquisitiveness\index{acquisitiveness} acquit\index{acquit} acquittal\index{acquittal} acquittance\index{acquittance} acquitter\index{acquitter} acre\index{acre} acreage\index{acreage} acrid\index{acrid} acridity\index{acridity} acridness\index{acridness} acrimonious\index{acrimonious} acrimoniousness\index{acrimoniousness} acrimony\index{acrimony} acrobat\index{acrobat} acrobatic\index{acrobatic} acrobatics\index{acrobatics} acronym\index{acronym} acrophobia\index{acrophobia} acropolis\index{acropolis} across\index{across} acrostic\index{acrostic} acrylate\index{acrylate} acrylic\index{acrylic} act's\index{act's} act\index{act} actinic\index{actinic} actinide\index{actinide} actinium\index{actinium} actinometer\index{actinometer} action\index{action} actionable\index{actionable} actioned\index{actioned} actioning\index{actioning} activate\index{activate} activated\index{activated} activating\index{activating} activation\index{activation} activator\index{activator} active\index{active} actively\index{actively} activeness\index{activeness} activism\index{activism} activity\index{activity} Acton\index{Acton} actor\index{actor} actress\index{actress} actual\index{actual} actuality\index{actuality} actuarial\index{actuarial} actuary\index{actuary} actuate\index{actuate} actuation\index{actuation} actuator\index{actuator} acuity\index{acuity} acumen\index{acumen} acupressure\index{acupressure} acupuncture\index{acupuncture} acute\index{acute} acuteness\index{acuteness} acyclic\index{acyclic} acyclovir\index{acyclovir} ad's\index{ad's} ad\index{ad} adage\index{adage} adagio\index{adagio} Adair\index{Adair} Adam\index{Adam} adamant\index{adamant} Adamski\index{Adamski} Adamson\index{Adamson} adapt\index{adapt} adaptability\index{adaptability} adaptation\index{adaptation} adapted\index{adapted} adaptive\index{adaptive} adaptivity\index{adaptivity} adaptor\index{adaptor} ADC\index{ADC} add-on\index{add-on} add\index{add} addend\index{addend} addenda\index{addenda} addendum\index{addendum} addict\index{addict} addiction\index{addiction} Addis\index{Addis} Addison\index{Addison} addition\index{addition} additional\index{additional} additive\index{additive} additivity\index{additivity} addle\index{addle} addorsed\index{addorsed} address\index{address} addressed\index{addressed} addressee\index{addressee} addresses\index{addresses} addressing\index{addressing} adduce\index{adduce} adducer\index{adducer} adduct\index{adduct} adduction\index{adduction} adductor\index{adductor} Adelaide\index{Adelaide} Adele\index{Adele} Aden\index{Aden} Adenauer\index{Adenauer} adenine\index{adenine} adenoid\index{adenoid} adenoidal\index{adenoidal} adenoma\index{adenoma} adenomata\index{adenomata} adenoviral\index{adenoviral} adenovirus\index{adenovirus} adept\index{adept} adeptness\index{adeptness} adequacy\index{adequacy} adequate\index{adequate} adequateness\index{adequateness} adhere\index{adhere} adherence\index{adherence} adherent\index{adherent} adhesion\index{adhesion} adhesive\index{adhesive} adhesiveness\index{adhesiveness} adiabatic\index{adiabatic} adieu\index{adieu} adipose\index{adipose} Adirondack\index{Adirondack} adiós\index{adiós} adjacency\index{adjacency} adjacent\index{adjacent} adjectival\index{adjectival} adjective\index{adjective} adjoin\index{adjoin} adjourn\index{adjourn} adjudge\index{adjudge} adjudicate\index{adjudicate} adjudication\index{adjudication} adjudicator\index{adjudicator} adjunct\index{adjunct} adjuration\index{adjuration} adjure\index{adjure} adjust\index{adjust} adjusted\index{adjusted} adjustor's\index{adjustor's} adjusts\index{adjusts} adjutant\index{adjutant} Adkins\index{Adkins} Adler\index{Adler} adman\index{adman} admen\index{admen} admin\index{admin} adminicle\index{adminicle} adminicular\index{adminicular} administer\index{administer} administrable\index{administrable} administrate\index{administrate} administration\index{administration} administrator\index{administrator} administratrix\index{administratrix} admirable\index{admirable} admiral\index{admiral} admiralty\index{admiralty} admiration\index{admiration} admire\index{admire} admissibility\index{admissibility} admissible\index{admissible} admission\index{admission} admit\index{admit} admittance\index{admittance} admitted\index{admitted} admixture\index{admixture} admonish\index{admonish} admonisher\index{admonisher} admonition\index{admonition} admonitory\index{admonitory} ado\index{ado} adobe\index{adobe} adolescence's\index{adolescence's} adolescence\index{adolescence} adolescent\index{adolescent} Adolph\index{Adolph} Adonis\index{Adonis} adopt\index{adopt} adopted\index{adopted} adoption\index{adoption} adopts\index{adopts} adorable\index{adorable} adorableness\index{adorableness} adoration\index{adoration} adore\index{adore} adorn\index{adorn} adorned\index{adorned} adrenal\index{adrenal} adrenalin\index{adrenalin} adrenaline\index{adrenaline} Adrian\index{Adrian} Adriatic\index{Adriatic} Adrienne\index{Adrienne} adrift\index{adrift} adroit\index{adroit} adroitness\index{adroitness} ads\index{ads} ADSL\index{ADSL} adsorb\index{adsorb} adsorbate\index{adsorbate} adsorbent\index{adsorbent} adsorption\index{adsorption} ADte\index{ADte} adulate\index{adulate} adulation\index{adulation} adulator\index{adulator} adult\index{adult} adulterant\index{adulterant} adulterate\index{adulterate} adulterated\index{adulterated} adulteration\index{adulteration} adulterer\index{adulterer} adulteress\index{adulteress} adulterous\index{adulterous} adultery\index{adultery} adulthood\index{adulthood} adumbrate\index{adumbrate} adumbration\index{adumbration} advance\index{advance} advantage\index{advantage} advantageous\index{advantageous} advantageousness's\index{advantageousness's} advantageousness\index{advantageousness} advent\index{advent} Adventist's\index{Adventist's} adventist\index{adventist} adventitious\index{adventitious} adventure's\index{adventure's} adventure\index{adventure} adventures\index{adventures} adventuresome\index{adventuresome} adventuress\index{adventuress} adventurism\index{adventurism} adventurous\index{adventurous} adventurously\index{adventurously} adventurousness\index{adventurousness} adverb\index{adverb} adverbial\index{adverbial} adversarial\index{adversarial} adversary\index{adversary} adverse\index{adverse} adverseness\index{adverseness} adversity\index{adversity} advert\index{advert} advertise\index{advertise} advertised\index{advertised} advertising\index{advertising} advice\index{advice} advisabilities\index{advisabilities} advisability's\index{advisability's} advisability\index{advisability} advisable\index{advisable} advise\index{advise} advisedly\index{advisedly} advisee\index{advisee} advisor\index{advisor} advisory\index{advisory} advocacy\index{advocacy} advocate\index{advocate} adware\index{adware} adze\index{adze} Aegean\index{Aegean} aegis\index{aegis} aegrotat\index{aegrotat} Aeneas\index{Aeneas} Aeneid\index{Aeneid} aeolian\index{aeolian} Aeolus\index{Aeolus} aeon\index{aeon} aerate\index{aerate} aeration\index{aeration} aerator\index{aerator} aerial\index{aerial} aerialist\index{aerialist} aerie\index{aerie} aero\index{aero} aero-engine\index{aero-engine} aeroacoustic\index{aeroacoustic} aerobatic\index{aerobatic} aerobic\index{aerobic} aerodrome\index{aerodrome} aerodynamic\index{aerodynamic} aerodynamics\index{aerodynamics} aeroelastic\index{aeroelastic} aeroelasticity\index{aeroelasticity} aerofoil\index{aerofoil} aerogel\index{aerogel} aerogramme\index{aerogramme} aerolite\index{aerolite} aeromagnetic\index{aeromagnetic} aeromedical\index{aeromedical} aeromodeller\index{aeromodeller} aeromodelling\index{aeromodelling} aeronautic\index{aeronautic} aeronautical\index{aeronautical} aeronautics\index{aeronautics} aerophone\index{aerophone} aeroplane\index{aeroplane} aeroponic\index{aeroponic} aeroponically\index{aeroponically} aerosol\index{aerosol} aerospace\index{aerospace} Aeschylus\index{Aeschylus} Aesculapius\index{Aesculapius} Aesop\index{Aesop} aesthete\index{aesthete} aesthetic\index{aesthetic} aestheticism\index{aestheticism} aestival\index{aestival} aestivate\index{aestivate} aether\index{aether} aetiology\index{aetiology} AFAIK\index{AFAIK} afar\index{afar} AFC\index{AFC} affability\index{affability} affable\index{affable} affair\index{affair} affect\index{affect} affectation\index{affectation} affected\index{affected} affectedly\index{affectedly} affecter\index{affecter} affecting\index{affecting} affection\index{affection} affectionate\index{affectionate} affectionately\index{affectionately} affective\index{affective} affects\index{affects} afferent\index{afferent} affiance\index{affiance} affidavit\index{affidavit} affiliate\index{affiliate} affiliated\index{affiliated} affiliation\index{affiliation} affine\index{affine} affinity\index{affinity} affirm\index{affirm} affirmation\index{affirmation} affirmed\index{affirmed} affirms\index{affirms} affix\index{affix} afflatus\index{afflatus} afflict\index{afflict} affliction\index{affliction} affluence\index{affluence} affluent\index{affluent} afford\index{afford} affordable\index{affordable} afforest\index{afforest} afforestation\index{afforestation} affray\index{affray} affricate\index{affricate} affrication\index{affrication} affricative\index{affricative} affright\index{affright} affront\index{affront} Afghan\index{Afghan} Afghani\index{Afghani} Afghanistan\index{Afghanistan} aficionado\index{aficionado} afield\index{afield} afire\index{afire} aflame\index{aflame}
%Set index pagestyle
\pagestyle{index}
\printindex
\end{document}
(注意:样式文件中我留下了一些额外的部分,以展示如何在样式中放置其他项目并同时抓取标记 - 如果需要,可以删除它们 - 这些是点填充以及一些 alpha 标题)