协作编辑LaTeX文档的提示

时间:2023-01-14 06:09:47

My default setup is to put the tex source in a subversion repository and insert notes to each other as comments in the source when making changes to other people's content. It all feels pretty sub-optimal, especially when there are subversion conflicts where all it tells you is "these two versions of this huge paragraph are in conflict."

我的默认设置是将tex源放在subversion存储库中,并在更改其他人的内容时将注释作为源中的注释插入彼此。这一切都感觉非常不理想,特别是当存在颠覆冲突时,所有它告诉你的是“这个巨大段落的这两个版本都存在冲突”。

I've come up with a few tricks but I'm sure there are much better ideas (or better versions of my ideas) out there.

我想出了一些技巧,但我确信那里有更好的想法(或更好的我的想法版本)。

For collaborating on code, see this question:

有关代码协作,请参阅此问题:

How do you collaborate with other coders in real time?

你如何实时与其他程序员合作?

(Some of those answers will apply to collaboration on LaTeX documents as well.)

(其中一些答案也适用于LaTeX文档上的协作。)

2 个解决方案

#1


Always end each sentence with a newline. Never reformat paragraphs. These rules not only minimize spurious conflicts but also make your collaboratively edited paper easier to revise.

总是用换行符结束每个句子。永远不要重新格式化段落。这些规则不仅可以最大限度地减少虚假冲突,还可以使协作编辑的论文更容易修改。

For author commentary I use marginal comments:

对于作者评论,我使用边际评论:

\long\def\authornote#1{%
        \leavevmode\unskip\raisebox{-3.5pt}{\rlap{$\scriptstyle\diamond$}}%
        \marginpar{\raggedright\hbadness=10000
        \def\baselinestretch{0.8}\tiny
        \it #1\par}}
\newcommand{\simon}[1]{\authornote{SLPJ: #1}}
\newcommand{\norman}[1]{\authornote{NR: #1}}
\newcommand{\john}[1]{\authornote{JD: #1}}

We put these in the margin because frequently we're preparing a paper to strict length limits, and we want the marginal notes not to change the length of the paper. Marginal notes are then turned off by

我们把这些放在边缘,因为我们经常准备一份严格的长度限制的纸张,我们希望边际注释不要改变纸张的长度。然后关闭边缘音符

\long\def\authornote#1{\relax}

I also invented the nbibtex tool (now in Debian!) so that you can use different .bib files from your coauthors without having to agree on arbitrary BibTeX keys. nbibtex works like BibTeX except that it uses key words from author, title and other fields. Each author's BibTeX file can be different, but if the paper is there, nbibtex will find it.

我还发明了nbibtex工具(现在在Debian中!),这样你就可以使用你的共同作者的不同.bib文件而不必同意任意的BibTeX键。 nbibtex的工作方式与BibTeX类似,只是它使用来自作者,标题和其他领域的关键词。每个作者的BibTeX文件都可以不同,但​​如果纸张在那里,nbibtex会找到它。

#2


To mitigate the problem of unhelpful subversion conflicts, you can adopt the convention of newlines at the end of sentences. (This also makes it easier to rearrange or comment out, or comment on, sentences.)

为了缓解无助的颠覆冲突问题,您可以在句子末尾采用换行符约定。 (这也可以更容易地重新排列或评论或评论句子。)

As for comments to each other in the text source, I find it's better to make those appear in the pdf document but have the ability to turn them off for the final version. I use a macro "kibitz" for that. To use it, put the following at the top of the document:

至于文本源中对彼此的评论,我发现最好让它们出现在pdf文档中,但能够将它们关闭以用于最终版本。我使用宏“kibitz”。要使用它,请将以下内容放在文档的顶部:

\newcount\Comments  % 0 suppresses notes to selves in text
\Comments=1   % TODO: set to 0 for final version

\documentclass{article}   % or whatever your documentclass

% for comments
\usepackage{color}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\definecolor{purple}{rgb}{1,0,1}
% \kibitz{color}{comment} inserts a colored comment in the text
\newcommand{\kibitz}[2]{\ifnum\Comments=1\textcolor{#1}{#2}\fi}
% add yourself here:
\newcommand{\alice}[1]{\kibitz{red}      {[ALC: #1]}}
\newcommand{\bob}[1]  {\kibitz{purple}   {[BOB: #1]}}
\newcommand{\carol}[1]{\kibitz{cyan}     {[CAR: #1]}}
\newcommand{\deb}[1]  {\kibitz{darkgreen}{[DEB: #1]}}
\newcommand{\evan}[1] {\kibitz{blue}     {[EVN: #1]}}

Then Alice, for example, can just stick something like \alice{Bob must've added the previous sentence which is obviously false.} and it will show up in red in the pdf as long Comments is set to 1.

例如,爱丽丝可以坚持使用类似\ alice {Bob必须添加前一个明显错误的句子。}并且当注释设置为1时,它将在pdf中以红色显示。

#1


Always end each sentence with a newline. Never reformat paragraphs. These rules not only minimize spurious conflicts but also make your collaboratively edited paper easier to revise.

总是用换行符结束每个句子。永远不要重新格式化段落。这些规则不仅可以最大限度地减少虚假冲突,还可以使协作编辑的论文更容易修改。

For author commentary I use marginal comments:

对于作者评论,我使用边际评论:

\long\def\authornote#1{%
        \leavevmode\unskip\raisebox{-3.5pt}{\rlap{$\scriptstyle\diamond$}}%
        \marginpar{\raggedright\hbadness=10000
        \def\baselinestretch{0.8}\tiny
        \it #1\par}}
\newcommand{\simon}[1]{\authornote{SLPJ: #1}}
\newcommand{\norman}[1]{\authornote{NR: #1}}
\newcommand{\john}[1]{\authornote{JD: #1}}

We put these in the margin because frequently we're preparing a paper to strict length limits, and we want the marginal notes not to change the length of the paper. Marginal notes are then turned off by

我们把这些放在边缘,因为我们经常准备一份严格的长度限制的纸张,我们希望边际注释不要改变纸张的长度。然后关闭边缘音符

\long\def\authornote#1{\relax}

I also invented the nbibtex tool (now in Debian!) so that you can use different .bib files from your coauthors without having to agree on arbitrary BibTeX keys. nbibtex works like BibTeX except that it uses key words from author, title and other fields. Each author's BibTeX file can be different, but if the paper is there, nbibtex will find it.

我还发明了nbibtex工具(现在在Debian中!),这样你就可以使用你的共同作者的不同.bib文件而不必同意任意的BibTeX键。 nbibtex的工作方式与BibTeX类似,只是它使用来自作者,标题和其他领域的关键词。每个作者的BibTeX文件都可以不同,但​​如果纸张在那里,nbibtex会找到它。

#2


To mitigate the problem of unhelpful subversion conflicts, you can adopt the convention of newlines at the end of sentences. (This also makes it easier to rearrange or comment out, or comment on, sentences.)

为了缓解无助的颠覆冲突问题,您可以在句子末尾采用换行符约定。 (这也可以更容易地重新排列或评论或评论句子。)

As for comments to each other in the text source, I find it's better to make those appear in the pdf document but have the ability to turn them off for the final version. I use a macro "kibitz" for that. To use it, put the following at the top of the document:

至于文本源中对彼此的评论,我发现最好让它们出现在pdf文档中,但能够将它们关闭以用于最终版本。我使用宏“kibitz”。要使用它,请将以下内容放在文档的顶部:

\newcount\Comments  % 0 suppresses notes to selves in text
\Comments=1   % TODO: set to 0 for final version

\documentclass{article}   % or whatever your documentclass

% for comments
\usepackage{color}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\definecolor{purple}{rgb}{1,0,1}
% \kibitz{color}{comment} inserts a colored comment in the text
\newcommand{\kibitz}[2]{\ifnum\Comments=1\textcolor{#1}{#2}\fi}
% add yourself here:
\newcommand{\alice}[1]{\kibitz{red}      {[ALC: #1]}}
\newcommand{\bob}[1]  {\kibitz{purple}   {[BOB: #1]}}
\newcommand{\carol}[1]{\kibitz{cyan}     {[CAR: #1]}}
\newcommand{\deb}[1]  {\kibitz{darkgreen}{[DEB: #1]}}
\newcommand{\evan}[1] {\kibitz{blue}     {[EVN: #1]}}

Then Alice, for example, can just stick something like \alice{Bob must've added the previous sentence which is obviously false.} and it will show up in red in the pdf as long Comments is set to 1.

例如,爱丽丝可以坚持使用类似\ alice {Bob必须添加前一个明显错误的句子。}并且当注释设置为1时,它将在pdf中以红色显示。