0

I've been using TeX Live 2018 and installed some packages to that, now that 2019 is out, I need to intall that new version (windows). I am using basis scheme install option (plain and latex) for normal reasons. Is it possible to like import 2018 packages, which are installed on my computer to 2019? Or idk, install them again but not manually like create a list or something?

Another sub question would be if it is possible to copy the packages to another computer, or copy the list of those packages and on other computer click on it and install them in 1 go.

  • 1
    This question has been asked before, but no real solutions have been provided. See for example tex.stackexchange.com/questions/179925/…, tex.stackexchange.com/questions/342219/…, tex.stackexchange.com/questions/377233/…. One way is to create a list of installed packages (tex.stackexchange.com/questions/56009/…) – Marijn Jun 7 at 12:26
  • and use that list to install the same packages again in the new installation with tlmgr (with some batch processing to transform the list in a sequence of tlmgr commands). 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 7 at 12:28
  • ok, Ive created a list of the installed packages, its 278 for me, most of which are probably from the standard installation, is it possible to import this list on another PC/verstion through tlmgr or even tex live manager? I have no idea on how to do batch processing or so. – A.Ston Jun 7 at 13:50
  • See for example stackoverflow.com/questions/155932/…. In this case you can do for /F "tokens=*" %%A in (mypackages.txt) do tlmgr install %%A in a cmd.exe terminal (untested, I don't have Windows here so I just copy-pasted it). – Marijn Jun 7 at 15:52
  • 1
    I made it, I used matlab though to import both files (2018 package list and 2019 package list), used some regexp to get lists of pure package names and checked those for differences. That would be packages in old file which are not in new file. So exported those as a simple string with spaces inbetween. Then I just type tlmgr install and 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 7 at 20:14
0

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 dowloaded 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 missiong packages in new.txt

  • maybe some kind soul could write this script in C++ and make an exe file or something that does not require additional software, for easyer use for others. – A.Ston Jun 7 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.