23

Basically, I need to do the same thing as this answer but with overleaf instead. I tried the following. I opened two windows of the same project. I placed each one of them on a different monitor. In one I let the code go fullscreen, while in the other one I let the pdf preview go full screen. But the pdf preview doesn't get updated even if the code on one screen gets compiled? I have to separately compile the pdf window too.

11
  • 3
    I would ask the Overleaf support
    – cgnieder
    Feb 20, 2020 at 7:50
  • 3
    I have already asked them. They have no idea how to do so. Feb 20, 2020 at 7:55
  • 2
    well if overleaf staff don't know you are unlikley to get more informed answers here, however having said that if you really want this you could have a single desktop extending over both screens rather than two separate desktops and just arrange that the left half with the code is on one and the right half with the pdf is on the other, that doesn't use anything specific to the overleaf website Feb 20, 2020 at 11:52
  • 1
    Maybe you can automatically refresh the second window using a browser extension? For example addons.mozilla.org/en-US/firefox/addon/tab-auto-refresh for Firefox.
    – Marijn
    Feb 20, 2020 at 12:52
  • 1
    @TejasShetty depends on your operating system, in Windows just select "extend" rather than "duplicate" when setting up the second monitor Feb 20, 2020 at 14:24

8 Answers 8

17

As of 15 June 2022, this is now made possible in Overleaf, see the blog announcement: New feature: ready, set… DETACH!

Basically, you just need to click on the upper right button Layout, then PDF in separate tab, see below:

enter image description here

1
  • beat me to this answer Jul 3, 2022 at 6:51
10

This question has been answered in the FAQ on Overleaf:

On Overleaf v1: Yes, there's actually a trick that lets you do this: if you open the same project in two different browser windows, hide the preview in one, and hide the source in the other, the preview in the second window will still update as you make edits. To hide the editor or preview panes, simply click on the arrow buttons at the top of the vertical divider bar (located between the writing pane and the preview pane).

On Overleaf v2: It is not advisable to edit a project on two windows or tabs at once, especially if you've also enabled Autocompile—this may cause an infinite compilation loop in both windows or tabs.

1
  • 6
    It's a shame this isn't possible on Overleaf v2. Expanding across multiple monitors "works" but definitely isn't the ideal solution. Jul 13, 2021 at 16:42
8

supersize your browser tab to span both monitor screens, and adjust the divider to fit in the middle of both screens. you will get pdf full screen on the monitor on the right, and source code full screen on the monitor on the left. since it is the same browser tab the pdf will be recompiled automatically.

3
  • 1
    Please could you give more details. Apr 3, 2020 at 14:06
  • 1
    Basically operates on the assumption that the two monitors are "connected", i.e. you can drag your mouse continuously from one monitor to the other. Someone I know liked doing it this way too. Stretch your browser window across both screens by dragging the "expand" arrows with your mouse.
    – Sterling
    Oct 30, 2020 at 23:40
  • 2
    Workable workaround for Windows and Linux. Doesn't work on Mac OS as far as I can tell.
    – Christian
    Aug 1, 2021 at 9:44
7

One way is by injecting custom javascript. Recompile when the window is focused.

You can use CJSv2 plugin for chrome and write a simple JS to recompile on window focus.

// Set up event handler to produce text for the window focus event
window.addEventListener("focus", function(event) 
{ 
    $(".btn-recompile")[0].click();
}, false);

Voila! You can open a pdf preview in a separate tab on a different monitor and whenever you click on it (focus on the window), it recompiles.

4
  • 3
    can you please add more explicit instructions for this? Where and how do I run this piece of code? May 21, 2020 at 11:37
  • This is definitely a smart work around. I wonder if there is a way to add a piece of JS so that the preview can be separated as a pop up window.
    – River
    Jul 21, 2020 at 19:05
  • I could use more detailed instructions as well.
    – Kvothe
    Mar 8, 2021 at 17:42
  • This seems to be outdated according to [yo](tex.stackexchange.com/users/11002/yo ) Mar 22, 2021 at 4:59
5

Detailed explanation of kingspp's answer:

  1. In chrome Install the CJS extension.
  2. Make sure that the extension is set in the upper right corner of the browser.
  3. Once you are in the window with the overleaf expanded pdf viewer click on the extension icon and insert the code suggested by kingspp.
  4. Make sure a version of jQuery is selected and the "Enable CJS on this host" toggle switch is activated.
  5. Click on "save" and it's done
2

I just duplicate the browser tab with overleaf (I use Firefox).
(very similar to Larsson's proposition)
I put one tab on the first monitor where I hide the pdf part, the second (duplicated) tab is put on the second monitor where I hide the edit part.
A little price to pay : instead of the usual ctrl-enter to recompile, I have to type alt-tab before ctrl-enter to select the window with the pdf view and alt-tab again to go back to the editor window.
It works with the present version of Overleaf.

When in error, you may need to recompile the source side to have the error indications on the source file.

1
  1. I copy the project link, open a new tab, and paste it in.
  2. At the end of the link I insert /output/output.pdf

Example:

Link of the project I am editing:

https://www.overleaf.com/project/625c3d2477155b3a949525f8

Link in the new tab that I opened:

https://www.overleaf.com/project/625c3d2477155b3a949525f8/output/output.pdf

NOTE: In this case the PDF is not updated automatically, every time you compile you have to update the tab in which the output.pdf is open. But you can do as the above colleagues informed, add the CJS in this tab.

0
1

Here's a different JavaScript solution for Overleaf v2:

  • In your overleaf window, press ctrl+shift+I to open the developer console

  • paste the following code into the console, hit enter, and close the console again:

var win = null; 
let btn = document.createElement("button");
btn.innerHTML = "⛶";
btn.onclick = function() {
    win = window.open(document.querySelector("iframe").src)
    document.querySelector("iframe").addEventListener("load", function(pdf) {
        win.location = pdf.target.src;
    });
};
document.querySelector('[class="toolbar-pdf-left"]').appendChild(btn)

This adds a new button above the pdf preview that will open it in a popup window: enter image description here

The popup window will automatically update as you recompile. IMPORTANT: if you want to minimize the code preview on the original page, DON'T do it by clicking the ">" button. Instead, shrink it manually with your mouse (dragging the vertical dots to the right). Otherwise the popup can't update.

If you don't want to do these steps manually after every refresh, you can install this chrome extension. Click it while you're in overleaf, tick "Enable on" on the top right, paste the code in, then "Save & Run".

enter image description here

You must log in to answer this question.

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