TransWikia.com

Splitting the same text in two windows with Texstudio

TeX - LaTeX Asked on July 10, 2021

How is it possible to split the same text in two windows with TeXstudio, like it is done here : https://tex.stackexchange.com/a/364455/89734.

I like very much TeXstudio since a friend introduced me to it. This editor has really amazing features. But I miss this emacs feature: it enables e.g. to copy a part of a text and to paste it in another part (like a complicated formula) without having to scroll the text.

2 Answers

I don't think TeXstudio can do this.

You can find an open feature request for this on the TeXstudio SourceForge page. In the discussion below this request one of the developers of TeXstudio indcates that this feature is unlikely to be implemented in the near future:

Tim Hoffmann — 2017-05-09

No changes. This is not possible with the current editor component and it doesn't look like there'll be an alternative. So as of now, there is no indication that this request can be fulfilled.

Correct answer by Circumscribe on July 10, 2021

It is possible by adding a hard link in the file system and use the original file in the first view and the hardlinked file in the second view of the splitted editor window.

In detail...

To add a hardlink in NTFS filesystem you need to start cmd with administrator rights by pressing the WIN key, typing cmd, clicking "run as administrator". Lets assume your document is called document.tex. Then type:

mklink /H documentlink.tex document.tex

This will generate a hard link called documentlink.tex. This link behaves like a normal file.

Working with LUNIX the command:

ln document.tex documentlink.tex

should do the job.

So in the end you have two files document.tex and documentlink.tex pointing to the same data on hard-disk. This means when you edit (and save) one of the files the other one is also modified the same way.

Now you can load document.tex and documentlink.tex in the editor and move the documentlink.tex to the other view. Then change the data in document.tex. When you try to edit documentlink.tex you will be notified once that the file has changed.

It is possible to view different positions and copy and paste text between these files. When you save or compile one file, the other one is updated automatically.

I use this work around at the moment and it works very well for me, since my texfile has grown quite large.

Please use this settings in TexStudio:

Options menu
Configuration
Show Advanced Options
Adv. Editor
(uncheck) Safe writing of files
(check) Monitor open files for external changes
(check) Silently reload saved files on external changes

Safe writing to files will overwrite the hardlink since the programm saves to a temporary file and copies it to the file named in the editor. So it has to be deactivated.

When you work with Linux then load the original file first, then the hardlink. Move the hardlink to the second view and mark this tab as read only. Only edit and save the first tab. Now it works also under Linux :)


Here's a reference Steven pointed to: https://www.tenforums.com/tutorials/131182-create-soft-hard-symbolic-links-windows.html#option3

Because hard links are handled at the OS level, the technique works for any editor (confirmed [by Steven] for TeXworks).

Answered by alzi on July 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP