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.

12
  • 1
    Is writelatex not an option ?
    – percusse
    Apr 30, 2013 at 20:35
  • 2
    selfhosted, so perhaps not, unless this is Hammersley.
    – kan
    Apr 30, 2013 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, 2013 at 20:37
  • @FSMaxB Oops, missed that part.
    – percusse
    Apr 30, 2013 at 20:38
  • @FSMaxB Is this related ? texlive.js possible? Apr 30, 2013 at 20:40

9 Answers 9

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.

4
  • Is it still free in 2023? The pricing page mentions $999/year for the Docker version. Jun 27 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. Jun 29 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 cocalc.com/support/new or email me personally at wstein at cocalc.com. Jun 30 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.) Jun 30 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

1
  • 1
    Sharelatex is to my knowledge now part of Overleaf. Mar 15, 2022 at 9:35
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;
    }
1
  • 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 3, 2013 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

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>
3
  • Thanks for your suggestion, but I need to work on full LaTeX documents and create PDFs as an end product.
    – FSMaxB
    May 11, 2013 at 5:02
  • @FSMaxB PMWiki has print command which will get you PDF. May 11, 2013 at 12:37
  • But Mathjax doesn't have full LaTeX support. I am looking for the normal output of pdflatex or xetex or whatever to be displayed in the browser.
    – FSMaxB
    May 11, 2013 at 14:15
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
  • 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, 2021 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .