42

I'm searching for a LaTeX editor that I can run on my GNU/Linux server and allows realtime collaboration as well as online compiling and previewing.

What I've tried so far:

So my question: Can anyone suggest such an editor that is actually working or does anyone know how to solve the issues I encountered with FlyLaTeX and Cloud9 IDE.

Edit: I wrote an email to the developer of FlyLaTeX and he explained that FlyLaTeX currently doesn't support additional LaTeX packages. So FlyLaTeX is not an option right now.

I stumbled across etherTeX, based on etherpad lite. I'll try this one out.

giordano
  • 8,486
FSMaxB
  • 479
  • 1
    Is writelatex not an option ? – percusse Apr 30 '13 at 20:35
  • 2
    selfhosted, so perhaps not, unless this is Hammersley. – kan Apr 30 '13 at 20:36
  • @percusse I want to host it on my own server which as to my knowledge isn't possible with writelatex. – FSMaxB Apr 30 '13 at 20:37
  • @FSMaxB Oops, missed that part. – percusse Apr 30 '13 at 20:38
  • @FSMaxB Is this related ? texlive.js possible? – texenthusiast Apr 30 '13 at 20:40
  • @texenthusiast No, I have no problem installing texlive on my server, so I don't need a javascript latex compiler. My question is more about collaboration and online preview than compiling it in the browser, but thanks anyway. – FSMaxB Apr 30 '13 at 20:43
  • there is a project for a LaTeX editor and compiler app running on the OwnCloud infrastructure, but AFAIK it's still in its infancy and I'm not sure it will suit your needs. Anyway, you may want to check it out. Of course, it needs an OwnCloud installation. See here and here (gitorius repo). – d-cmst Apr 30 '13 at 20:57
  • @dcmst I happen to have an installation of owncloud, I'll try it, but I'm not very amazed by the stability of owncloud as a whole. – FSMaxB Apr 30 '13 at 20:59
  • @FSMaxB looking at the pages linked by myself (!) I just noticed this: This app has been disabled due to several critical vulnerabilities - maintainer, please contact lukas@owncloud.org as soon as possible so we can resolve this. Which looks really scary... So I'm kind of retracting my suggestion... – d-cmst Apr 30 '13 at 21:05
  • @dcmst I wouldn't recommend using ownCloud at all, my experience is not that great. It's far from being stable and good in performance. (And installing plugins doesn't seem to work for me anyway) – FSMaxB Apr 30 '13 at 21:08
  • Have you had a look at the answers to http://tex.stackexchange.com/q/27549/86? Is web-based essential? Some collaborative editors (such as Gobby) set up their own server so aren't accessed through a browser. – Andrew Stacey May 03 '13 at 09:05
  • @AndrewStacey Thanks for providing the link. I already considered Gobby but couldn't find out how to setup the server. Additionally, gobby isn't able to compile LaTeX server side. I would prefer a solution which works from nearly everywhere, so a web based solution is the way to go. – FSMaxB May 03 '13 at 09:48

9 Answers9

11

You can use the CoCalc Docker image as a very easy to install free open source self-hosted collaborative web-based LaTeX editor. See https://github.com/sagemathinc/cocalc-docker. To test out how it feels, go to https://cocalc.com, make a project, click +New, make a LaTeX file, and test out editing. This is a full featured latex editor, with forward and inverse search (double click the preview on the right to go to the corresponding point on the left, etc.). You can split the editor pane on the left to view two points in the document at once. There is syntax highlighting, code folding, and the TimeTravel button let's you view every past version of the document (see why it suddenly doesn't compile!). Sign in with another browser (or account) to test realtime collaborative editing.

enter image description here

I originally wrote this collaborative LaTeX editor to support writing the book http://wstein.org/rh/ with Barry Mazur, but Harald Schilly and others have greatly improved it over the years.

Since I'm the guy that started SageMath, the LaTeX editor in CoCalc also fully supports SageTex out of the box, and more generally, you can completely customize anything about the compilation pipeline.

  • Is it still free in 2023? The pricing page mentions $999/year for the Docker version. – Saaru Lindestøkke Jun 27 '23 at 12:16
  • 1
    @SaaruLindestøkke According to the README in the GitHub's repo it depends on which licensing model you choose. My guess would be that you can still create your own Docker image, if the repository doesn't mention about you having to pay for the code in order to use it. – rbaleksandar Jun 29 '23 at 16:59
  • It is still free in 2023. We sell a $999/year license for supported commercial use. For personal use, it's free. If anybody has any questions about how their intended usage would be classified, please don't hesitate to contact us at https://cocalc.com/support/new or email me personally at wstein at cocalc.com. – William Stein Jun 30 '23 at 17:28
  • Also, I recently added ChatGPT integration in the cocalc-docker latex editor, so when you have errors, you can click a button and chatgpt will automatically try to figure out how to fix the errors. This will work in cocalc-docker if you put your own openai api key in admin settings. (Support for GPT-4 and 16k context is also coming soon.) – William Stein Jun 30 '23 at 17:30
10

An other solution for "selfhosted collaborative webbased LaTeX editor" is sharelatex. They have got an Homepage where you can work with there system but you can also host it on your own Server. Here is the link to the code: https://github.com/sharelatex/sharelatex

kimliv
  • 377
3

A possible solution would be to use any online/selfhosted collaboration tool (Cloud 9/Collide etc.) to do the editing to a .tex file and then use a small php or bash script to process the TeX file through PHP/Shell on the click of a button.

Using some PHP like this perhaps:

private function runXeLaTeX($dir = '/tmp', $fileToUse, $noPDF = FALSE) {
        $descriptorspec = array(
                0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
                1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
                2 => array("file", $dir."/error-output.txt", "a") // stderr is a file to write to
        );

        $cwd = $dir;
//      $env = array('some_option' => 'aeiou');

        if ($noPDF) {
            $process = proc_open('/usr/texbin/xelatex -no-pdf '.$fileToUse.'.tex', $descriptorspec, $pipes, $cwd);
        }
        else {
            $process = proc_open('/usr/texbin/xdvipdfmx -vv '.$fileToUse.'.xdv', $descriptorspec, $pipes, $cwd);
        }

        if (is_resource($process)) {
            // $pipes now looks like this:
            // 0 => writeable handle connected to child stdin
            // 1 => readable handle connected to child stdout
            // Any error output will be appended to /tmp/error-output.txt

            fwrite($pipes[0], '<?php print_r($_ENV); ?>');
            fclose($pipes[0]);

//          echo stream_get_contents($pipes[1]);
            fclose($pipes[1]);

            // It is important that you close any pipes before calling
            // proc_close in order to avoid a deadlock
            $return_value = proc_close($process);
        }
        return $return_value;
    }
doncherry
  • 54,637
McGafter
  • 2,266
  • FlyLaTeX and Cloud9 IDE are both based on NodeJS. And are not running on a PHP capable webserver. As I don't know how to work with nodejs nor how to integrate PHP in it, this isn't anything I could do. I tried doing it myself by combining the ace text editor with a PDF preview, but my PHP and JavaScript skills are insufficient. – FSMaxB May 03 '13 at 10:04
2

Also have a look at http://fiduswriter.org/ It is developing quickly and supportts collaboration and uses LaTeX code in its backend.

2

This seems to be just such a solution:

Collaborative Writing Using Etherpad and LaTeX

A Feldman
  • 3,930
1

This might not be exactly what you want but you can run a simple collaborative webbased LaTeX editor by running PMWiki on your server with MathJax enabled. To enable MathJax on your server you can simply edit

/pub/skins/myskin/myskin.tmpl

file by adding the following into the header

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'],
['\\(','\\)']]}});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
1

FlyLatex now (since early June 2013, I believe) supports extra packages. Put any extra packages in the "texpackages." The packages/images will be available to all users (global-level access). I made it this way to save space for the administrator. But I'm working on adding an option to make packages/images uploadable and accessible on a per-user level.

1

Overleaf seems to be a really good option. It is a pleasure to use their editor and their tutorials are to my mind one of the best recurses for learning LaTeX.

  • 1
    To be clear: as of 2021: Overleaf is not just a commercial service, but also an open source project. You can install the server using docker. This answer (maybe with some edits to clarify is likely the best, currently. (Bu personallyt I've put off doing the install and just subscribed to Overleaf premium for one year of testing!) – CPBL Sep 24 '21 at 22:05
0

Using FlyLaTeX is an option if no extra packages and document classes are needed. It can be installed by performing those steps (when using Ubuntu Server 12.04):

  • Create a user for the installation of FlyLaTeX e.g. "flylatex"
  • Install git and mongodb with sudo apt-get install mongodb git
  • Change to the home directory of the new user and install the node version manager (git clone git://github.com/creationix/nvm.git and echo '. ~/nvm/nvm.sh' >> ~/.bashrc)
  • Install nodejs (e.g. v0.10.5 nvm install v0.10.5)
  • Install FlyLaTeX (git clone git://github.com/alabid/flylatex.git)
  • Start FlyLaTeX with nvm use v0.10.5; node ~/flylatex/app.js

This isn't working for me, as I need extra LaTeX packages, I just post this so it can be useful to others.

FSMaxB
  • 479