Dear all, between the days, as we say in Germany, I setup a proof of concept for a repository with documents that reference each other. I followed the Wiki: https://wiki.contextgarden.net/References_notes_and_floats/References I had no problems when all master files were in the same toplevel folder: master-1.tex master-2.tex components-for-1/ components-for-2/ I also tried to include files from other folders outside the hierarchy of the main folder with \useexternaldocument, but that does not work. While \from gave the intended result, \at, \about, \in and \page does not. While I did not expect this to work at all, as relative paths and absolute paths may break when you deliver the final pdfs via a web service or put them in an other folder somewhere else I wonder why \from works and the others not. Is it correct that the best and robust way to make a group of documents that reference each other is to put them in the same folder? TIA and a happy new year juh
Hi Jan ! The directory structure issue isn't very complicated with "environment," but it can become so. In principle, the env/ directory should contain everything related to settings: env-book-styles.mkiv, env-book-whatever.mkiv, as well as image folders and any folders related to what you want to import (e.g., the folder with MetaPost figures codes). The main/master file should be placed with the components, which are themselves divided into frontmatter, bodymatter, and backmatter. I But that's not all! In the "environment" files, we need to specify the paths we need (to the directories), but not the *.tex files. The environment file is useful for global settings. Example: % env-mybook.mkiv % ------------------ \setuppaths [frontmatter, bodymatter, backmatter, figures, metapost lua, xml] % Fonts \setupbodyfont[...] % Latour \setuplayout[...] % Styles \setuphead[...] % Macros global \def\WkSomething{...} The file main.tex/master.tex is very poor : % master.tex % entry point (project) \environment env/env-book \starttext \product env-book \stoptext Here below is the scheme : project/ ├─ master.tex ├─ env/ │ └─ env-yourbook-styles.mkiv │ ├─ frontmatter/ │ ├─ 01-title.tex │ ├─ 02-preface.tex │ ├─ bodymatter/ │ ├─ 10-introduction.tex │ ├─ 20-whatever .tex │ ├─ backmatter/ │ ├─ 60-bibliographie.tex │ ├─ 61-index.tex Inside each directory (frontmatter, bodymatter, backmatter),you will develop .tex files called "components." We do not compile these components directly: main.tex will do that. Jean-Pierre Delange
Le 30 déc. 2025 à 11:47, Jan Ulrich Hasecke via ntg-context
a écrit : Dear all,
between the days, as we say in Germany, I setup a proof of concept for a repository with documents that reference each other.
I followed the Wiki: https://wiki.contextgarden.net/References_notes_and_floats/References
I had no problems when all master files were in the same toplevel folder:
master-1.tex master-2.tex components-for-1/ components-for-2/
I also tried to include files from other folders outside the hierarchy of the main folder with \useexternaldocument, but that does not work.
While \from gave the intended result, \at, \about, \in and \page does not.
While I did not expect this to work at all, as relative paths and absolute paths may break when you deliver the final pdfs via a web service or put them in an other folder somewhere else I wonder why \from works and the others not.
Is it correct that the best and robust way to make a group of documents that reference each other is to put them in the same folder?
TIA and a happy new year juh
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Sorry Jan for not having fully understood the issue at first ! In CTX, usually cross-document references are resolved auxiliary data generated at compile time, not from the final PDF. Commands such as \at, \page, \in and \about need to this shared structural data, which means that all documents involved must belong to the same compilation context (i.e. share auxiliary files and consistent jobnames). To achieve reliable cross-references, the master documents therefore need to be compiled as part of a single project scope, typically by placing them in the same top-level directory or by otherwise sharing their auxiliary data. Jean-Pierre Delange
Le 30 déc. 2025 à 16:50, Jean-Pierre Delange
a écrit : Hi Jan !
The directory structure issue isn't very complicated with "environment," but it can become so. In principle, the env/ directory should contain everything related to settings: env-book-styles.mkiv, env-book-whatever.mkiv, as well as image folders and any folders related to what you want to import (e.g., the folder with MetaPost figures codes). The main/master file should be placed with the components, which are themselves divided into frontmatter, bodymatter, and backmatter. I But that's not all! In the "environment" files, we need to specify the paths we need (to the directories), but not the *.tex files. The environment file is useful for global settings. Example:
% env-mybook.mkiv % ------------------
\setuppaths [frontmatter, bodymatter, backmatter, figures, metapost lua, xml]
% Fonts \setupbodyfont[...]
% Latour \setuplayout[...]
% Styles \setuphead[...]
% Macros global \def\WkSomething{...}
The file main.tex/master.tex is very poor : % master.tex % entry point (project) \environment env/env-book \starttext \product env-book \stoptext
Here below is the scheme :
project/ ├─ master.tex ├─ env/ │ └─ env-yourbook-styles.mkiv │ ├─ frontmatter/ │ ├─ 01-title.tex │ ├─ 02-preface.tex │ ├─ bodymatter/ │ ├─ 10-introduction.tex │ ├─ 20-whatever .tex │ ├─ backmatter/ │ ├─ 60-bibliographie.tex │ ├─ 61-index.tex
Inside each directory (frontmatter, bodymatter, backmatter),you will develop .tex files called "components." We do not compile these components directly: main.tex will do that.
Jean-Pierre Delange
Le 30 déc. 2025 à 11:47, Jan Ulrich Hasecke via ntg-context
a écrit : Dear all,
between the days, as we say in Germany, I setup a proof of concept for a repository with documents that reference each other.
I followed the Wiki: https://wiki.contextgarden.net/References_notes_and_floats/References
I had no problems when all master files were in the same toplevel folder:
master-1.tex master-2.tex components-for-1/ components-for-2/
I also tried to include files from other folders outside the hierarchy of the main folder with \useexternaldocument, but that does not work.
While \from gave the intended result, \at, \about, \in and \page does not.
While I did not expect this to work at all, as relative paths and absolute paths may break when you deliver the final pdfs via a web service or put them in an other folder somewhere else I wonder why \from works and the others not.
Is it correct that the best and robust way to make a group of documents that reference each other is to put them in the same folder?
TIA and a happy new year juh
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Am 30.12.2025 um 11:36 schrieb Jan Ulrich Hasecke via ntg-context:
Dear all,
between the days, as we say in Germany, I setup a proof of concept for a repository with documents that reference each other.
I followed the Wiki: https://wiki.contextgarden.net/References_notes_and_floats/References
I had no problems when all master files were in the same toplevel folder:
master-1.tex master-2.tex components-for-1/ components-for-2/
I also tried to include files from other folders outside the hierarchy of the main folder with \useexternaldocument, but that does not work.
While \from gave the intended result, \at, \about, \in and \page does not.
While I did not expect this to work at all, as relative paths and absolute paths may break when you deliver the final pdfs via a web service or put them in an other folder somewhere else I wonder why \from works and the others not.
Is it correct that the best and robust way to make a group of documents that reference each other is to put them in the same folder?
To access references from another document context only needs the tuc-file to get the labels, sections numbers etc. You can also have the document and tuc files in different folders and put the path to the tuc file in the second argument of \useexternaldocument. Assume two document are in the subfolders 1 and 2 of a main folder you can use the following settings to refer to the other document: ./1/master-1.tex ./2/master-2.tex master-1.tex: \useexternaldocument [...] [../2/master-2] master-2.tex: \useexternaldocument [...] [../1/master-1] Wolfgang
Thanks Wolfgang, I have to recheck my setting. I think that I had it this way. Am 31.12.25 um 07:41 schrieb Wolfgang Schuster:
./1/master-1.tex ./2/master-2.tex
master-1.tex: \useexternaldocument [...] [../2/master-2]
master-2.tex: \useexternaldocument [...] [../1/master-1]
participants (3)
-
Jan Ulrich Hasecke -
Jean-Pierre Delange -
Wolfgang Schuster