lilypond-devel
[Top][All Lists]

## Re: How to use LaTeX code from manual to include LilyPond-generated TOC?

 From: Jean Abou Samra Subject: Re: How to use LaTeX code from manual to include LilyPond-generated TOC? Date: Thu, 10 Mar 2022 23:13:53 +0100 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0



Le 10/03/2022 à 23:11, Carl Sorensen a écrit :


﻿On 3/10/22, 2:58 PM, "lilypond-devel on behalf of Jean Abou Samra"
<lilypond-devel-bounces+carl.d.sorensen+digest=gmail.com@gnu.org on behalf of
jean@abou-samra.fr> wrote:

Hi,

The (pdf|Xe|(dvi)?Lua)?(La)?TeX experts in the room are going to
     find this question ridiculous, but anyway: how do I use the code
here?

The code goes in the preamble of your LaTeX document (before \begin{document})

You should have all the code, followed by

\begin{document}
\includescore{toc}
\end{document}

I think that will work.



Sorry if I was unclear: that is the version that LaTeX complains about
with "missing \begin{document}". The complete code is:

\documentclass{article}

\usepackage{pdfpages}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \includescore{PossibleExtension}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Read in the TOC entries for a PDF file from the corresponding .toc file.

% This requires some heave latex tweaking, since reading in things from a file
% and inserting it into the arguments of a macro is not (easily) possible

% Solution by Patrick Fimml on #latex on April 18, 2009:
% reads in the contents of the file into \variable (undefined if file
% doesn't exist)
\fi%
}
\typeout{No TOC file #1 available!}%
\else%
\gdef#2{}%
\fi
}%

\newcommand{\includescore}[1]{
\def\oly@fname{\oly@basename\@ifmtarg{#1}{}{_#1}}
\includepdf[pages=-]{\oly@fname}
\else
{\oly@fname}}\includeit
\fi
}

\begin{document}

\includescore{toc}

\end{document}

Thanks,
Jean

`