\newcounter{entry}[chapter]
\newcommand{\declarenewentry}[1]{\medskip\noindent\framebox[\textwidth][l]{\qquad Day \theentry : #1}\medskip}
\newcommand{\newentry}[1]{\addtocounter{entry}{1}\addtocounter{chapter}{1}\phantomsection \addcontentsline{toc}{chapter}{\protect\numberline{\theentry \qquad #1}}\declarenewentry{#1}}
MWE:
\documentclass{book}
\usepackage{bookmark, hyperref}
\newcounter{entry}[chapter]
\newcommand{\declarenewentry}[1]{\medskip\noindent\framebox[\textwidth][l]{\qquad Day \theentry : #1}\medskip}
\newcommand{\newentry}[1]{\addtocounter{entry}{1}\addtocounter{chapter}{1}\phantomsection \addcontentsline{toc}{chapter}{\protect\numberline{\theentry \qquad #1}}\declarenewentry{#1}}
\begin{document}
\frontmatter
\mainmatter
\newentry{August 10, 2021}
Sample Text
\section{Sample}
\newpage
\newentry{August 11, 2021}
\backmatter
\end{document}
Now, the problem is that these commands generate a bookmark, but they have no displayed names. I think this is because of \phantomsection
. I could probably achieve a better effect by using the sectsty
package, but is there a way to name the bookmark?
Edit: Output
As observed, there exists a bookmark with no name. Same goes below the section, as there is a second entry, though it is unnoticeable.
Best Answer
My impression is that instead of
\newentry
you want to use\chapter
.