4

The sidenotes package works pretty well, but I cant find a way to use the figure* environment. When I try:

 \documentclass{article}
 \usepackage{sidenotes}
 \usepackage{graphicx}
 \renewcommand{\footnote}{\sidenote}
 \renewcommand{\caption}{\sidecaption}


\begin{document}
\section{Title}\label{title}

Noice content. \sidenote{Sidenote}

\begin{figure*}
\centering
\includegraphics[]{fig.png}
\caption{Este é um sidecaption.}
\end{figure*}
\end{document}

I get:

<fig.png, id=1, 2248.4pt x 1585.925pt> <use fig.png>
! TeX capacity exceeded, sorry [grouping levels=255].
\caption@addtofont #1#2->\begingroup 
                                     \expandafter \let \expandafter \caption...
l.17 \end
         {figure*}
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on teste.log.

with:

pdflatex teste.tex

In order for that to become a MWE, just remove the caption within the figure* environment.

  • What am I doing wrong?
  • Use \ includegraphics {example-image-a} to include an image. Of all the ways to remove the lines from the figure, I can not compile your file. Give the error:! Missing number, treated as zero. <To be read again> \ Tex_let: D... Apparently the package is broken with the updated versions of ltx3 – Pablo González L Feb 19 '17 at 5:19
  • Without the figure * environment you can not compile either \documentclass{article} \usepackage{sidenotes} \begin{document} Noice content \sidenote{note} \end{document} – Pablo González L Feb 19 '17 at 5:26
  • The figure* environment comes with the sidenote package.. – lf_araujo Feb 19 '17 at 5:34
  • figure* does not make the difference, I have updated my version of TexLIve 2017 and commenting on those lines the file can not be compiled – Pablo González L Feb 19 '17 at 6:04
  • I just tested here 'figure*' does make a difference. Are you sure you removed the \caption as suggested in the text? My pdflatex is running `pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016/Arch Linux)'. Maybe that is related to the system I am running it in. The exact figure I am using is here. – lf_araujo Feb 19 '17 at 6:18
5

It does warn you that something will go wrong:

Package caption Warning: \caption will not be redefined since it's already
(caption)                redefined by a document class or package which is
(caption)                unknown to the caption package.
See the caption package documentation for explanation.

and then it does go wrong.

In general if you load two attempts to redefine the same command then things will break: you are loading caption package and then redefine \caption by hand.

Just use \sidecaption

 \documentclass{article}
 \usepackage{sidenotes}
 \usepackage{graphicx}
 \renewcommand{\footnote}{\sidenote}
 %\renewcommand{\caption}{\sidecaption}


\begin{document}
\section{Title}\label{title}

Noice content. \sidenote{Sidenote}

\begin{figure*}
\centering
\includegraphics[]{fig.png}
\sidecaption{Este é um sidecaption.}
\end{figure*}
\end{document}
  • This doesn't cure all the errors. – egreg Feb 19 '17 at 10:55
  • 4
    @egreg no, it still leaves poverty and world peace to fix. – David Carlisle Feb 19 '17 at 11:05
  • ! Missing number, treated as zero. <to be read again> \tex_let:D l.16 Noice content. \sidenote{Sidenote} – egreg Feb 19 '17 at 11:07
  • @egreg not in this MWE? – David Carlisle Feb 19 '17 at 11:13
  • @Yes, the same MWE – egreg Feb 19 '17 at 11:14
7

It's a bug in sidenotes.sty that does

\NewDocumentCommand \@sidenotes@multisign { } {3sp}

which is conceptually wrong, as \@sidenotes@multisign is used in expandable context.

It's also wrong to do \renewcommand{\caption}{\sidecaption}, because it either makes caption into not working at all or creates an infinite loop.

\documentclass{article}
\usepackage{sidenotes}
\usepackage{graphicx}

\renewcommand{\footnote}{\sidenote}

\makeatletter
\ExplSyntaxOn
\tl_set:Nn \@sidenotes@multisign {3sp}
\ExplSyntaxOff
\makeatother

\begin{document}
\section{Title}\label{title}

Noice content. \sidenote{Sidenote}

\begin{figure*}
\centering
\includegraphics[]{example-image}
\sidecaption{Este é um sidecaption.}
\end{figure*}
\end{document}

Actually, the package should be thoroughly rewritten.

  • 2
    Is there any easier way (from a regular user point of view) to set that value in a clean L3 way? – Johannes_B Feb 19 '17 at 10:59
  • For example \title{Wombat} for \maketitle. What is the L3 approach here? – Johannes_B Feb 19 '17 at 11:01
  • 1
    @Johannes_B I don't think that there are details on how the document level of L3 will look like. But I could imagine a keyval like setup: \setdocumentproperties{ title = Wombat } – clemens Feb 19 '17 at 11:13
  • @Johannes_B as far as \@sidenotes@multisign is concerned: this is an internal marker for the package which in L3 on the code level should be something like \l__sidenotes_multisign_dim and not be set by a user at all… – clemens Feb 19 '17 at 11:41
  • @Clemens How about a string i need to reuse? \documentclass{article} \usepackage{xparse} \newcommand{\foo}{foo} \NewDocumentCommand{\Foo}{}{foo} \begin{document} \MakeUppercase{\foo}% Wird expandiert \MakeUppercase{\Foo}% Nicht expandiert! \end{document} – Johannes_B Feb 19 '17 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.