Jump to content

Linking multiple files in Windows for simultaneous sync

Hi, I use a preamble file with my .tex documents using \include{preamble.tex} in my main file. Since, \include does not support global path, I have to make multiple copies of the preamble.tex file in locations of different  main .tex files. Also, it is easier to send any tex source to others this way, I simply send the folder/ keep it in the cloud.

However, when I want to modify the preamble.tex file, say add  a new package or a new macro, I have to painstakingly go through all the copies and change them accordingly. 

Is there a way I can link the copies such that if one of them gets updated all of them do?

I use windows btw. 

Thanks for the help in advance. 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Hmmm ... all I can think of is to have a junction / symbolic link folder in each folder with your documents and all point to the folder where you have your preamble .text file 

 

Does \include support  folders in the path ?

 

ex   

your preamble .text file is  in  c:/preamble/preamble.tex 

 

document 1 in c:/documents/doc1/ document.tex  ... and have a junction / link in that folder called FOLDERNAME which points to c:/preamble/  - then use \include{.\FOLDERNAME\preamble.txt}  or \include{FOLDERNAME\preamble.txt}  , whatever the syntax is. 

 

The parser should search for preamble.tex in the FOLDERNAME folder, which transparently redirects to C:/preamble folder, where there's a preamble.text for all your documents.

 

See MKLINK command in Windows - for your needs symbolic link is better than junction, junctions are more restrictive and less complex, sort of legacy mode. 

See https://superuser.com/questions/343074/directory-junction-vs-directory-symbolic-link  if you're really curious

 

So you would do MKDIR /D FOLDERNAME  "C:\Preamble Folder"  to create a fake folder called "FOLDERNAME" in the folder where you type the command, which redirects to c:\Preamble Folder 

 

You can delete the folder with RMLINK command or use junction from SysInternalsSuite : https://docs.microsoft.com/en-us/sysinternals/downloads/junction

 

Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    Specifies the new symbolic link name.
        Target  Specifies the path (relative or absolute) that the new link
                refers to.

C:\>

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×