TeX - LaTeX Asked by f-hollow on April 7, 2021
I add bookmarks to all sections in my project in the following way:
section{Introduction}
hypertarget{intro}{}
Some text.
I use these bookmarks later in URL links https://example.com/my-document.pdf#intro
.
Every time I create an URL referring to a certain section, I need to go back to my LaTeX project and look up the bookmark name as I have too many of them. I would like to have a list of all my bookmarks (ideally juxtaposed with the section names they mark).
I know that the list of all bookmarks can be generated with pdfinfo on the command line. However, along with the bookmarks I need, I get all kinds of other bookmarks added by LaTeX and irrelevant for me:
1 [ XYZ 57 785 null ] "Doc-Start"
1 [ XYZ 56 823 null ] "page.1"
2 [ XYZ 57 711 null ] "section.1"
3 [ XYZ 57 751 null ] "intro"
5 [ XYZ 57 666 null ] "lstlisting.-1"
5 [ XYZ 104 668 null ] "lstnumber.-1.1"
6 [ XYZ 57 785 null ] "subsection.1.1"
So is it possible to generate a list of bookmarks created by me with hypertarget
? I will be happy with any: the command line solution or a LaTeX macro.
I tried tinkering around myself and came up with some dirty but working solution thanks to this thread and this thread. I wish I could come up with a better one but need more experience. Still hope that somebody might offer a more elegant solution.
My dirty solution:
documentclass{article}
% Corrects issues with compatibility of XeLaTeX
% and hyperref to create bookmarks
special{dvipdfmx:config C 0x0010}
usepackage{hyperref}
usepackage{newfloat}% for listof
usepackage{comment}
%begin{comment}
% temp code for list of bookmarks
DeclareFloatingEnvironment[fileext=bkmrk]{bookmark}
makeatletter
newcommand*{currentname}{@currentlabelname}
renewcommand*{hypertarget}[2]{
addcontentsline{bkmrk}{bookmark}{currentname qquad | qquad #1}%
}
makeatother
AtBeginDocument{listofbookmarks}
% end of temp code
%end{comment}
begin{document}
newpage
section{First Section}
hypertarget{first}{}
newpage
section{Second Section}
hypertarget{second}{}
newpage
section{Third Section}
hypertarget{third}{}
end{document}
It gives me this:
Just before compiling my final PDF, I do the following:
Then I compile the PDF for publishing.
Answered by f-hollow on April 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP