1

I'm using the pdfpcnotes.sty style from https://github.com/cebe/pdfpc-latex-notes and I'm currently trying to make it preserve newlines, i.e. if I write

\pnote{
  * Foo
  * Bar
}

I want this to give me two lines of notes. I tried following this: https://tex.stackexchange.com/a/211907 but I have to admit that this wizardry is a bit above my LaTeX skills. As far as I can tell, newline and tab characters are redefined so that they can be captured by the argument...? What I came up with is:

[... stuff from pdfpcnotes.sty ...]

% Create the magical "dont swallow newlines" command..?
\makeatletter
\def\activateCtrlChars{%
  \catcode`\^^I=\active
  \catcode`\^^M=\active
  \begingroup\lccode`~=`\^^I\lowercase{\endgroup\def~}{&}%
  \begingroup\lccode`~=`\^^M\lowercase{\endgroup\def~}{\\}%
}
\begingroup
\obeylines
\gdef\gobbleLineBreak{\@ifnextchar^^M{\@gobble}{}}%
\endgroup%
\makeatother

% open file on \begin{document}
[... output header ...]
% define a # https://tex.stackexchange.com/a/37757/10327
[...]


\def\lastframenumber{0}

% This is the command that will be used. It first opens a group, then
% switches it into "dont swallow ctrl characters" mode, and then calls
% an auxiliary command that should then receive the newlines...
\newcommand{\pnote}{%
  \begingroup\activateCtrlChars\fetchPnoteArg
}

% The auxiliary command that should receive the newlines
\newcommand{\fetchPnoteArg}[1]{%
    \gobbleLineBreak

    % keep normal notes working
    \note{#1}%

    % if frame changed - write a new header
    [... uninteresting ...]

    % write note to file
    \wlog{========================================}
    \wlog{\unexpanded{#1}}
    \wlog{========================================}
    \immediate\write\pdfpcnotesfile{\unexpanded{#1}}%

    \endgroup
}

However, this still puts everything into one row. :( Does anyone see why it is not working in my case?

Thanks a lot!

  • You don't really give us enough to work with here. You need \obeylines. It appears in your code, but it is group limited (between a \begingroup and \endgroup) and so it is not "seen" by the argument of \pnote. – Steven B. Segletes May 3 '16 at 12:46

Browse other questions tagged or ask your own question.