subfiles
subfiles copied to clipboard
Can't do cross references with subfileinclude and subfolders
Hello,
First, thanks for this package.
It seems impossible to do cross references when these two conditions are respected at the same time:
- Using
\subfileinclude
instead of\subfile
- Putting our chapters in a subfolder
If I do so, the references are not found and replaced with ???
. If I use \subfile
or if I put all files in the same folder, then everything works as expected.
MWE:
main.tex
:
\documentclass[a4paper,12pt]{memoir}
\usepackage{xr-hyper} %% Allow cross references between files in subfiles
\usepackage{subfiles}
\externaldocument{\subfix{main}}
\usepackage{hyperref}
\begin{document}
%% Works
\subfile{chapters/chapter_1.tex}
\subfile{chapters/chapter_2.tex}
%% Does not work
%\subfileinclude{chapters/chapter_1.tex}
%\subfileinclude{chapters/chapter_2.tex}
\end{document}
chapters/chapter_1.tex
:
\documentclass[../main]{subfiles}
\begin{document}
\chapter{My Chapter}
\section{Hello}\label{sec:hello}
Say Hi!
\end{document}
chapters/chapter_2.tex
:
\documentclass[../main]{subfiles}
\begin{document}
\section{Boou}\label{sec:bou}
Hello \ref{sec:hello}
\end{document}