Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are there any currently working examples with this code? #3

Open
andersjohansson opened this issue Sep 9, 2016 · 2 comments
Open

Comments

@andersjohansson
Copy link

This seems like a promising project, but as far as I can tell none of the current code is production status, right now, right? Or rather, there doesn't seem to be any example I can get to work at all, and the tex-files in the repository don't match the dtx-file.

It's a pity, because it seems like a a good and general way for breadcrumbs.

Maybe you could add a note about the status? Because I downloaded it in the hope of having something that I could kind of use (even if it's beta).
Cheers,
Anders

@vermiculus
Copy link
Owner

vermiculus commented Sep 10, 2016

I'm working on completing the package, but there are some funky issues to sort out – I'll keep you posted 😄

It's worth noting that vermiculus/lt3stack contains the implementation of the breadcrumb datastructure, so you may have some luck with implementing. Recently, I've been trying to hook onto \@sect (arguments 2 and 7 are of interest) with xpatch to manage the stack.

@vermiculus
Copy link
Owner

Here's a sortof-working example:

% arara: pdflatex
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{brdcrmbs.sty}
% wget https://raw.githubusercontent.com/vermiculus/lt3wstack/master/lt3wstack.{tex,sty}
\RequirePackage{expl3,xpatch,xparse,lt3wstack}

\ExplSyntaxOn

\wstack_new:N \l__breadcrumbs_nav_wstack

\xapptocmd \@sect {
  \breadcrumbs_push:nn {#2} {#7}
%  \mark { \breadcrumbs_display: }
} {}{}

\cs_new:Npn \breadcrumbs_push:nn #1 #2 {
  \wstack_push:Nnn
    \l__breadcrumbs_nav_wstack
    { 0 - #1 } {#2}
}

\cs_new:Npn \breadcrumbs_display: {
  \wstack_use:Nn \l__breadcrumbs_nav_wstack {~$\to$~}
}

\NewDocumentCommand \ShowBreadcrumbs {} { \topmark }
\NewDocumentCommand \DispBreadcrumbs {} { \breadcrumbs_display: }
\ExplSyntaxOff
\endinput
\end{filecontents*}

\usepackage{brdcrmbs,fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\chead{\DispBreadcrumbs}
\cfoot{\thepage}

\begin{document}
\section{section}
\subsection{subsection}
\DispBreadcrumbs
\clearpage
\subsection{subsection}
\subsubsection{subsubsection}
\DispBreadcrumbs
\end{document}

\usepackage{mwe}
\begin{document}
\Blinddocument
\end{document}

I'd like to be using \mark for this, but the stack structure is \protected (by expl3) preventing it from expanding in the header. At the moment, this implementation is subject to strange bugs when sections begin pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants