## Crossing references

Hello

I have written a book (B1) with exercices. I have written the solutions in another book but in this book B2, I use references to results of B1. Of course, I could write "according to theorem 3.15" whic is about a result of Runge but it would be better to write e.g. "according to theorem T/ Runge". Since the marker T/ Runge is not present in B2, compilation would end with "according to theorem ??".

So my question is : Is it possible to make a sucessful reference to a marker which is not present in the current text ?

### As far as I know, the answer

As far as I know, the answer is no.  I did some internet searching and didn't find anything that might help.  Cross referencing works by creating the .aux file on the first compile pass that contains the label information.  On the second pass the .aux file is read and the information is used to resolve the cross references.  The compile of your current document doesn't have any information about the compile of your separate document.  Do an internet search that includes "LaTeX" and ".aux file" and you should be able to find more details.

Thank you for your answer. Maybe there is a a way to bypass the problem. I could includ all the solutions at the end of the book reset the number of pages to 1 at the right place. Meanwhile, since I want two separate books (in the end, I extract the solution book from the whole) with same number of chapters, I would have to reset also the counting of chapters at the begging of the solutions. But I don't know how to do that. Is-it possible ?

### A command of the

A command of the form

\setcounter{chapter}{0}

would reset the chapter counter.  You can select whatever value you wish.  See https://www.mackichan.com/techtalk/621.htm

You could also change the page counter with this command.

### I'm not sure if this is what

I'm not sure if this is what you're looking for, but check out packages xr and xr-hyper (the latter if your main document uses the hyperref package). I've not tried them myself, but from the description in TLC2 (p.78) I don't see why they couldn't work with SWP.

### Well, even though I may have

Well, even though I may have written what's in Typesetting Documents and the online help about the xr package, I'd forgotten about it.  I don't remember ever trying to actually use the package.

### So, I have had a glance at

So, I have had a glance at the xr package... As I'm an always Latex beginner, I haven't understood how it is supposed to work. However, it seems that it should enable to enanle what I want.

Meanwhile, the solution of writing the solutions of exercices at the end of the book whith a reset of counters for pages and chapters works more ore less. The less is that e.g. headlines for pdf navigation within the document don't work any more. I think there more drawbacks due to the fact that there are two pages withe the number or 2 chapters with the same number...

For this rough solution, I would like to change the naming of chapters ; currently it is e.g. "Chapter 1" and then the title I have choosen e.g. "Solutions for exercices of chapter 1". I would like to merge the two...

### I just gave xr a try and it

I just gave xr a try and it seems to work as advertised. See the description in the SWP5 online help (search for "xr"). Basically, it seems that you can refer to anything in an external tex document that's been given a marker or label in that document. A couple of supplementary notes:

1. In the \externaldocument command (in the preamble) you need to provide the full path to the external tex file; you must use Unix path separators ("/") and you must omit the .tex extension. An example would be:

\externaldocument{c:/swwrk/airt/Airt}

referring to c:\swwrk\airt\Airt.tex.

2. I believe that xr works by reading the .aux file of the external document. So if something seems to go wrong, try re-compiling the external document so that its .aux file is up to date.

3. The SWP help on xr says to insert a tex field when referring to an external document. My one-time experience is that this isn't needed: you can just insert an ordinary Insert > TypesetObject > CrossReference field, and fill it in as you would any cross-reference referring to the current document. (But if George says I'm wrong here, listen to him).

### What I really appreciate with

What I really appreciate with SWP is that its desk always find a solution and don't bargain its help with people unfluent with Latex...

So after I follow you explanations (thank your for the example ; one example is often clearer than a general latex explanation), I compiled the latex file and everything wnt as I wanted !

Thank you !