1

I'm following Overleaf example of 'subfiles'

... and also some examples of the 'verse' and the 'song' packages

The subfiles work well but when called by main.tex the song package does not work properly

Is this common in latex, ie. that packages do not work with 'subfiles'

main.tex

\documentclass{article}

\usepackage{subfiles} 

\title{Subfiles package example}
\author{Overleaf}
\date{ }

\begin{document}
\maketitle
\section{Poems}

\subfile{sections/poems}
%\pagebreak
\section{Songs}

\subfile{sections/cords}
\end{document}

cords.tex

\documentclass[../main]{subfiles}
\usepackage[chorded]{songs}
\noversenumbers

\begin{document}
\songsection{Worship Songs}

\begin{songs}{}
\beginsong{Doxology}[by={Louis Bourgeois and Thomas Ken},
                     sr={Revelation 5:13},
                     cr={Public domain.},
                     index={Praise God, from Whom all blessings flow}]
\beginverse
\[G]Praise God, \[D]from \[Em]Whom \[Bm]all \[Em]bless\[D]ings \[G]flow;
\[G]Praise Him, all \[D]crea\[Em]tures \[C]here \[G]be\[D]low;
\[Em]Praise \[D]Him \[G]a\[D]bove, \[G]ye \[C]heav'n\[D]ly \[Em]host;
\[G]Praise Fa\[Em]ther, \[D]Son, \[Am]and \[G/B G/C]Ho\[D]ly \[G]Ghost.
\[C]A\[G]men.
\endverse
\endsong
\end{songs}

\end{document}

poems.tex

 \documentclass[../main]{subfiles}
\usepackage{verse}

\begin{document}

\poemtitle{Mathematics}
\settowidth{\versewidth}{Than Tycho Brahe, or Erra Pater:}
\begin{verse}[\versewidth]
In mathematics he was greater \\
Than Tycho Brahe, or Erra Pater: \\
For he, by geometric scale, \\
Could take the size of pots of ale;\\
Resolve, by sines and tangents straight, \\
If bread or butter wanted weight; \\
And wisely tell what hour o’ the day \\
The clock does strike, by Algebra.
\end{verse}
\attrib{Samuel Butler (1612--1680)}

\end{document}
7
  • 1
    When compiling main.tex the preambles of cords.tex and poems.tex are ignored. You need the preamble of main.tex to do everything necessary for the subfiles to compile.
    – Dai Bowen
    Jun 23, 2023 at 13:33
  • Possible duplicate tex.stackexchange.com/q/612279/106162
    – Dai Bowen
    Jun 23, 2023 at 13:48
  • 1
    You can get different typesetting by changing the typesetting, but if you want to use genuinely incompatible packages compiling separate documents and stitching together the PDFs with pdfpages is probably the easiest.
    – Dai Bowen
    Jun 23, 2023 at 14:31
  • 1
    LaTeX works fine, but it's as good as carrying out contradictory instructions as anything else (bad). If packages are incompatible (I know nothing about songs and verse, maybe they work fine together, maybe that's the question you really want to be asking here?) then there's nothing you can do unless you can patch the issue (that can sometimes be as simple as swapping the order they load, or as complicated as completely rewriting both packages).
    – Dai Bowen
    Jun 23, 2023 at 16:39
  • 3
    See Conflict between packages verse and songs for how to use verse and songs in the same document.
    – gernot
    Jul 11, 2023 at 10:03

0

You must log in to answer this question.

Browse other questions tagged .