I'm writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two computers, and also would like to keep a revision history. I chose git as my DVCS, and I'm hosting my repository on my server. I'm also using Kile + Okular to do the editing. Kile doesn't have an integrated git plugin. I'm also not collaborating with anyone on this text. I'm also thinking about putting another private repository on codaset, if my server for some reason is not accessible.

在这种情况下,推荐的工作流实践是什么?如何在这个工作方案中进行分支?是否有一种方法可以比较同一文件的两个版本?用藏东西怎么样?

乳胶源代码清单应该是什么样的,才能产生像已知书籍中那样的输出,例如Spring Framework的输出?我已经尝试了乳胶列表包,但不能产生一些看起来像下面一个。因此,我主要对生成如下示例的格式说明感兴趣(来自Manning的Spring in Action示例章节):

编辑 在Tormod Fjeldskår的帮助下,这里是完整的代码片段,以产生所需的外观:

\usepackage{listings}
\usepackage{courier}
\lstset{
    basicstyle=\footnotesize\ttfamily, % Default font
    % numbers=left,              % Location of line numbers
    numberstyle=\tiny,          % Style of line numbers
    % stepnumber=2,              % Margin between line numbers
    numbersep=5pt,              % Margin between line numbers and text
    tabsize=2,                  % Size of tabs
    extendedchars=true,
    breaklines=true,            % Lines will be wrapped
    keywordstyle=\color{red},
    frame=b,
    % keywordstyle=[1]\textbf,
    % keywordstyle=[2]\textbf,
    % keywordstyle=[3]\textbf,
    % keywordstyle=[4]\textbf,   \sqrt{\sqrt{}}
    stringstyle=\color{white}\ttfamily, % Color of strings
    showspaces=false,
    showtabs=false,
    xleftmargin=17pt,
    framexleftmargin=17pt,
    framexrightmargin=5pt,
    framexbottommargin=4pt,
    % backgroundcolor=\color{lightgray},
    showstringspaces=false
}
\lstloadlanguages{ % Check documentation for further languages ...
     % [Visual]Basic,
     % Pascal,
     % C,
     % C++,
     % XML,
     % HTML,
     Java
}
% \DeclareCaptionFont{blue}{\color{blue}} 

% \captionsetup[lstlisting]{singlelinecheck=false, labelfont={blue}, textfont={blue}}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox[cmyk]{0.43, 0.35, 0.35,0.01}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize}}

在你的文档中使用它:

\lstinputlisting[label=samplecode, caption=A sample]{sourceCode/HelloWorld.java}

如何在IPython Notebook中显示LaTeX代码?

如何将整个文档的字体更改为sans-serif(或其他任何东西)?

默认情况下(使用普通样式)BibTeX按字母顺序排序引用。

如何按文献中出现的顺序排列引文?

在LaTeX中,我如何定义一个字符串变量,其内容被使用而不是编译PDF中的变量?

假设我正在写一个软件的技术文档,我想在序言或其他地方定义包的名称,这样如果它的名称发生了变化,我就不必在很多地方替换它,而只需在一个地方替换它。

如何在LaTeX文档中插入代码?比如:

\begin{code}## Heading ##
...
\end{code}

我唯一真正需要的是缩进和固定宽度的字体。语法高亮显示可能很好,尽管它绝对不是必需的。

我正在LaTeX中创建一个报告,其中涉及到几个表。我卡住了,因为我在表格中的单元格数据超过了页面的宽度。我能否以某种方式将文本换行,使其落入表中相同单元格中的下一行?

它是否与桌子的宽度有关?但由于它超出了页面的宽度,会有什么不同吗?

我试图插入一个PDF或doc文件作为附录在我的LaTeX文件。你知道我该怎么做吗?