I solved this as follows: After installation of the new distribution (both are now installed)
- Open old Tex Live command-line and type
tlmgr list --only-installed > old.txt.
- Open new Tex Live command-line and type
tlmgr list --only-installed > new.txt.
Now copy those 2 files into a same folder, then I wrote a little script in MATLAB, it is simple and it probably can also be written in any other language, here it is:
oldfile=fopen('old.txt');
oldtext=fread(oldfile,'*char')';
fclose(oldfile);
oldpackages=regexp(oldtext,'(?<=i )[\w\.\-]+(?=:)','match')';
clear oldfile oldtext
newfile=fopen('new.txt');
newtext=fread(newfile,'*char')';
fclose(newfile);
newpackages=regexp(newtext,'(?<=i )[\w\.\-]+(?=:)','match')';
clear newfile newtext
packagestoadd=strjoin(oldpackages(~ismember(oldpackages,newpackages)));
clear newpackages oldpackages
the packagestoadd variable now contains all names of packages, which are installed on the old distribution but not on the new one.
- Now go to the new TeX Live command-line again (you have to open it as admin if it is installed in a folder like
Programm files though), type tlmgr install and copy the string from the mentioned variable right after this command.
Edit: I have wrote this script in C++ and compiled it, here is the code:
#include <set>
#include <regex>
#include <fstream>
using namespace std;
int main()
{
regex re("^i ([\\w\\.\\-]+):");
smatch match;
string line;
ifstream newFile("new.txt");
set<string> newPackages;
while (getline(newFile, line))
{
regex_search(line, match, re);
newPackages.insert(match.str(1));
}
newFile.close();
ifstream oldFile("old.txt");
ofstream file("toadd.txt");
while (getline(oldFile, line))
{
regex_search(line, match, re);
if (newPackages.find(match.str(1)) == newPackages.end())
{
file << match.str(1) << endl;
}
}
oldFile.close();
file.close();
}
I have also compiled it for windows x64, you can use it without additional software. there is also a batch file, which then installs TeX Live packages automatically. I upload it here: C++ executable. To use it simply download, put in any folder on your PC, then let TeX Live command line create the 2 text files (must be named old.txt and new.txt) and put them into the same folder as the 2 downloaded files. Then simply double click on the bat file.
If you installed your TeX Live in the Programm Files folder, which needs admit permissions, you will need to run cmd or TeX Live command line as admin, navigate to the folder in which you copied the files (with cd command) and then type import texlive packages.bat.
If you just want to know the difference, you can double click on the exe file, it will only create a new text file containing the missing packages in new.txt.
tlmgr(with some batch processing to transform the list in a sequence oftlmgrcommands). But it is rather impractical, it would be nice if TeX Live would implement a proper updating procedure instead of 'just start from scratch every time'. – Marijn Jun 07 '19 at 12:28for /F "tokens=*" %%A in (mypackages.txt) do tlmgr install %%Ain acmd.exeterminal (untested, I don't have Windows here so I just copy-pasted it). – Marijn Jun 07 '19 at 15:52tlmgr installand copy that string behind this command, it installs all packages then ^.^. Also awesome to port the packages to another computer. Thanks for help! – A.Ston Jun 07 '19 at 20:14cmd /kat the end of your batch file to keep the window open, or alternatively run the file itself withcmd /k yourbatchfile.bat(see https://stackoverflow.com/questions/17957076/keep-cmd-open-after-bat-file-executes). – Marijn Aug 22 '19 at 11:15tlmgryou can check withtlmgr --versionto see which version it is. Presumably the version of TeX Live that you installed most recently is the one in the path. If it is not the one you want you can use the absolute (full) file path inside of the batch file, something likeC:\texlive\2018\texmf-dist\bin\x86_64\tlmgr.exeor similar. – Marijn Aug 22 '19 at 11:17cmd /k "for /F "tokens=*" %%A in (mypackages.txt) do tlmgr install %%A"but using this the following commands after this line won't execute. It has something to do with thetlmgr install packagein the batch file, because even without a loop, this single command stops the batch file after the line's execution – A.Ston Aug 22 '19 at 13:33