TransWikia.com

'missing item' error when using `addtocontents` to insert a new line in the table of figures

TeX - LaTeX Asked on December 29, 2021

According to the requirements of my school, the List of Tables and List of Figures must have an underlined Table and Page headings right above the columns of table of contents

A “Page” column heading that appears below the major heading, is aligned flush with the right margin, is underlined, and appears between the major heading and the first entry. Page numbers must appear under this column heading.

My code works and yields the desired output

enter image description here

However, I get the error ‘Something’s wrong–perhaps a missing item. addvspace {10p@ }’.

documentclass[11pt]{book}

usepackage[TS1]{fontenc}
usepackage{fontspec}
setmainfont{Georgia}

usepackage{hyperref}
hypersetup{colorlinks=true}

usepackage{gensymb}

usepackage{caption}

usepackage{ulem}
usepackage{tocloft}

begin{document}

frontmatter
pagestyle{plain}

clearpage
listoffigures

clearpage
listoftables

clearpage
tableofcontents

mainmatter
addtocontents{lot}{protect uline{Table} hspace{fill} uline{Page}}
addtocontents{lof}{protect uline{Figure} hspace{fill} uline{Page}}


chapter{Introduction}

begin{figure}

    caption{A Caption of a Figure}

end{figure}

begin{table}

    caption{A Caption of a Table}

end{table}

end{document}

One Answer

Move addtocontents after the start of the first chapter and load hyperref as last package

documentclass[11pt]{book}

usepackage[TS1]{fontenc}
usepackage{fontspec}
setmainfont{Georgia}




usepackage{gensymb}

usepackage{caption}

usepackage{ulem}
usepackage{tocloft}

usepackage{hyperref}
hypersetup{colorlinks=true}
begin{document}

frontmatter
pagestyle{plain}

clearpage
listoffigures

clearpage
listoftables

clearpage
tableofcontents

mainmatter






chapter{Introduction}


addtocontents{lot}{protect uline{Table} hspace{fill} uline{Page}}
addtocontents{lof}{protect uline{Figure} hspace{fill} uline{Page}}
begin{figure}

    caption{A Caption of a Figure}

end{figure}

begin{table}

    caption{A Caption of a Table}

end{table}

end{document}

enter image description here

Answered by user191948 on December 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP