LaTeX 文档的跨平台编辑?
在 Windows 和 Linux 上处理 LaTeX 文档有哪些解决方案?
这是一个很大的文档,我每天都会在两个平台上工作,因此如果它是两个不同的软件,兼容性就至关重要。
包含轻松预览的解决方案的奖励积分。
What solutions are there for working on a LaTeX document on both Windows and Linux?
It's a large document, and I will be working daily on both platforms so compatibility is essential if it's two different pieces of software.
Bonus points for a solution that includes easy previewing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(16)
我使用一些文本编辑器,然后我有一个 cron 作业,它每小时从我的源代码管理中进行一次编译。
I use some text editor, and then I have a cron job that does a compile hourly from my source control.
Tex 文件只是文本。 我建议使用版本控制系统(无论如何你都应该使用它)来保持源同步。 然后,您可以在每个系统上使用任何(或不同)编辑器,例如用于 linux 的 Kile 和 winEdt 适用于 Windows。 两者都有不错的观众。
对于源代码管理的简单解决方案,只需最少的知识和麻烦,请考虑 dropbox。
Tex files are just text. I would recommend using a version control system (you should be using that anyway) to keep the source in sync. You can then use any (or different) editors on each system, e.g. Kile for linux and winEdt for windows. Both com with nice viewrs.
For a simple solution for the source control that just works with minimum knowledge and hassle, consider dropbox.
几年后重新审视我自己的问题,我想我应该添加
https://www.writelatex.com/
严格来说并不符合我的想法,但已将其用于协作写作
Revisiting my own question after quite a few years, I thought I'd add
https://www.writelatex.com/
not strictly what I had in mind, but have used it for collaborative writing
Texmaker 是一个优秀的多平台 LaTeX IDE。
对于 Debian 或 Ubuntu,我制作了一个易于理解的教程:在 Ubuntu 或 Debian 上安装 LaTeX< /a>. 本教程介绍如何在 Debian 或 Ubuntu 上安装 LaTeX 以及如何创建您的第一个 PDF。
An excellent multiplatform LaTeX IDE is Texmaker.
For Debian or Ubuntu, I made a tutorial easy to follow: Install LaTeX on Ubuntu or Debian. This tutorial explains how to install LaTeX on Debian or Ubuntu and how to create your first PDF.
2023 年的答案是使用 Visual Studio Code 以及适当的插件 (LaTeX 研讨会,LaTeX 实用程序 和 LTeX,例如)
A 2023 answer is to use Visual Studio Code with the appropriate plugins (LaTeX Workshop, LaTeX Utilities and LTeX, for example)
编写文本与编写软件没有太大区别。 扩大规模时也适用类似的管理技术。
模块化:将文档分割成更小的部分,例如每个章节都有一个单独的
.tex
文件。 我还喜欢将序言和其他 LaTeX 设置与正文分开。 我的章节文件本身只有带有一些标记的正文,但没有定义任何新命令。源代码控制:将所有源文件保存在版本控制工具(例如 subversion)中。 使用该工具在系统之间传输文件。
构建:使用 Makefile 或类似文件来控制构建过程:它应该是一致且可重复的。 定期构建并尽快修复构建问题。 如果您想要轻松预览,您可以设置 Makefile 规则以在编译目标 PDF 后启动 PDF 查看器。
编辑:使用您兼容的任何内容。 尽管其他回答者已经给出了一些好的建议,但这并不重要。
沟通:如果有多个人在做同样的事情,没有任何工具可以替代人际沟通。
沟通
Writing text is not very different from writing software. Similar management techniques apply when scaling up.
Modularity: Split the document to smaller pieces e.g. a separate
.tex
file for each chapter. I also like to keep the preamble and other LaTeX set-up separate from the body text. My chapter files themselves just have the body text with some markup but do not define any new commands.Source control: Keep all the source files in a version control tool such as subversion. Transfer files between systems using the tool.
Builds: Have a Makefile or similar to control the build process: it should be consistent and repeatable. Build regularly and fix build problems as soon as possible. If you want easy previews, you can set up a Makefile rule to launch e.g. a PDF viewer after the target PDF has been compiled.
Editing: Use whatever you're compatible with. It does not matter that much, though some good advice has been given by other answerers.
Communication: If there's more than one person working on the same stuff, no tool is a substitute for interpersonal communication.
TeXworks 是一个新的跨平台 TeX 编辑器,具有内置 PDF 预览功能,具有源输出同步。 单击源可转到输出中的匹配部分,反之亦然。 从设计上来说,它并不是功能最丰富的编辑器,但在我看来,简单性/功能的权衡恰到好处。
TeXworks is a new cross-platform TeX editor with a built-in PDF preview that has source-output synchronisation. Click in the source to go to the matching part in the output, and vice versa. It's not the most feature-rich editor, by design, but the simplicity/power trade-off is just right, in my opinion.
我使用过 Emacs 及其 AucTeX 模式,该模式非常适合编辑,因为它有一组非常一致的快捷方式来插入许多常见命令和环境。 还有在 Emacs 窗口中以图形方式显示数学的预览模式,但我没有使用它们。
与 VIM 一样,当然有一个学习曲线。
与 Legoolas 不同,我建议使用 pdfTeX 直接编译为 PDF,但也许 Windows/Linux 没有自动重新加载文件的 PDF 查看器? 如果是这样我会感到惊讶(我在 Mac 上使用 Skim)。 检查您的查看器是否支持 synctex,因为在 PDF 和源文件之间导航非常方便,而且没有 pdfsync 的缺点。
为了进行编译,我选择的工具是 TeXlive 中包含的 latexmk。 它完全自动化构建,并且可以监视
.tex
源以自动重建。I've used Emacs and its AucTeX mode, which is great for editing, as it has a set of very consistent shortcuts to insert many common commands and environments. There are also preview modes that display maths graphically in the Emacs window but I haven't used them.
As with VIM, there's a learning curve of course.
Unlike Legoolas, I'd advise for direct-to-PDF compilation using pdfTeX, but maybe Windows/Linux doesn't have a PDF viewer that automatically reloads the file? I'd be surprised if so (I use Skim on Mac). Check if your viewer supports synctex, as it's quite handy to navigate from PDF to source and back, without the cons of pdfsync.
To compile, my tool of choice is latexmk which is included in TeXlive. It completely automates the build, and can watch the
.tex
source to rebuild automatically.尝试 LyX – 文档处理器,一个“所见即所得”的 LaTeX 编辑器。
Try LyX – The Document Processor, a "What You See Is What You Mean" editor for LaTeX.
Eclipse 及其 TeXlipse 插件应该可以解决 IDE 问题。 然而,更重要的是仅使用两个平台上可用或可安装的字体等问题。
为了进行预览,我使用 Emacs 及其 AucTeX 中的 预览 Latex 功能包裹。
Eclipse with its TeXlipse plugin should solve the IDE problem. More important are, however, issues like using only fonts that are available or installable on both platforms.
For previewing I am using Emacs with its Preview Latex feature in the AucTeX package.
由于您可能不想更改通常用于编辑 LaTeX 文档的文本编辑器(除非您使用的编辑器无法对 LaTeX 以及您在其中编码/编写的任何其他内容进行语法突出显示),所以我推荐以下简单的工具集:
无论您使用什么文本编辑器,只要它可以突出显示 LaTeX 标记即可。 如果不能,那么找到一个更好的编辑器来配合你所做的一切!。
安装MikTeX 或TeXLive 并只需双击 DVI 文件即可使用附带的 DVI 查看器。 每当您编辑 Latex 文件并重新创建输出来更改 dvi 文件时,这都会自动更新。
我在 Linux 和 Windows 上都使用 Emacs 作为我选择的文本编辑器。 当我按下某个键时,设置一些脚本或 makefile 来构建 Latex 文档非常简单,并且非常适合我使用 Emacs 进行的其他操作。
其他跨平台选项(其中许多选项已被其他人在此线程中提到):
Since you'll probably not want to change text editor from whatever you usually use just for editing LaTeX docs (unless you use an editor which can't do syntax highlighting for LaTeX as well as whatever else you code/write in it), I'd recommend the simple following set of tools:
Whatever text editor you are used to, as long as it can highlight LaTeX markup. If it can't, then find a better editor for using with everything you do!.
Install MikTeX or TeXLive and just use the DVI viewer which comes with them by double-clicking on your DVI file. This will automatically update whenever the dvi file is changed by your editing of the latex file and re-creating the output.
I use Emacs as my text editor of choice, on both Linux and Windows. Setting up some scripts or makefiles to build the latex document when I hit a key is pretty easy, and fits in with everything else I use Emacs for nicely.
Other cross-platform options (many of which have already been mentioned by others in this thread):
对于 Windows,您可以使用 TeXnicCenter,它是 Windows 上最好的 IDE 之一。
对于 Linux,您可以简单地使用 Kile (可以在 CygWin 上将 kile 与 KDE 一起使用,但它不是完美的解决方案)。
从一种IDE切换到另一种IDE是没有问题的(因为你只保存.tex文件而没有其他任何东西)
它也存在一些跨平台IDE,但我不知道它们:
For windows, you can use the TeXnicCenter, that is one of the best IDE for windows.
For Linux, you can use simply use Kile (it is possible to use kile with KDE on CygWin, but it is not the perfect solution).
There is no problem to switch from one IDE to another one (since you just save the .tex file and nothing else)
It also exists some cross-platform IDE, but I do not know them:
我使用 VIM 并结合 VIM-LaTeX 插件,取得了巨大成功。 但它确实有一些学习曲线。
I've used VIM, combined with the VIM-LaTeX plugin, with great success. It does have a bit of a learning curve though.
Gummi 是最好的 LaTeX 编辑器。 它是一个用 python 编写的免费开源程序,具有实时预览窗格。
http://gummi.midnightcoding.org/
e4 http://gummi.midnightcoding.org/wp-content/uploads/20091012-1large(1).png< /a>
Gummi is the best LaTeX editor. It is a free, open source, program written in python, featuring a live preview pane.
http://gummi.midnightcoding.org/
e4 http://gummi.midnightcoding.org/wp-content/uploads/20091012-1large(1).png
将您的工作放入某种版本控制系统中,然后当您从一台计算机移动到另一台计算机时,您只需从中央服务器进行更新,就像您离开它一样。
IDE 并不重要,因为您只保存 .tex 文件,如上所述。 如果您想使用相同的编辑器,为了一致性,请使用 texmaker。
Get your work in some kind of version control system, then when you move from computer to computer you just update from a central server and its just like you left it.
It doesn't matter about the IDE, as you are saving just the .tex file, as noted above. If you want to use the same editor though, for the sake of coherency, use texmaker.
我使用版本控制,在 Windows 上使用 MikTex/WinEDT,在 Mac 上使用 TexShop。
如果您的文档不能在两个平台上编译,您可能忘记保持两个目录同步或使用时髦的命令,我喜欢进行健全性检查,因为知道它可以在两个平台上干净地“编译”。
I use version control, and just use MikTex/WinEDT on Windows and TexShop on the mac.
IF your document doesn't compile on both, you're probably forgetting to keep the two directories synchronized or use funky commands, I like the sanity checks of knowing that it "compiles" cleanly on two platforms.