我有几个独立的 LaTeX 文件,我想以一致的方式将它们合并到一个 scrbook 中,这样每个 LaTeX 文档都是书中的新章节。此外,页码应该是连续的,索引也应该是一致的。提前致谢
编辑:这是序言,所有文章几乎都相同:
% (1) The line below says asks LaTeX to use the ``article'' class for typesetting,
% with the options being: 11pt font, letterpaper, and double-spacing
\documentclass[11pt, letterpaper,doublespacing]{article}
% (2) This package enables the ``doublespacing'' option in the first line
\usepackage{setspace}
% (3) Changing format of Section number and formatting of section headers
% The ``makatletter'' command is a special LaTeX switch
% that changes the meaning of the ``@'' character, so that
% this character can be used in the commands that follow.
% The ``makeatletter'' switch will be turned off using
% the ``makeatother'' command below.
\makeatletter
% (3.1) Put a period after section number
\renewcommand{\@seccntformat}[1]{\@nameuse{the#1}.~{}}
% Change format of numbers
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\Alph{subsection}}
\renewcommand{\thesubsubsection}{\arabic{subsubsection}}
% (3.2) Change format of header text
\renewcommand{\section}{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\centering\normalfont\large\bfseries}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\large\slshape}}
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\centering\normalfont\slshape}}
% (3.3) The next command turns of the switch that changed the meaning of the “@” character.
\makeatother
%: (4) Changing formatting of theorem-like structures
% The next command loads the ``amstheorem'' package
% to adjust formatting of theorem-like structures
\usepackage{amsthm}
%Define ``plain'' style
\newtheoremstyle{plain}{9pt}{9pt}{\itshape}{0pt}{\scshape}{:}{3pt}{}
% Load ``plain'' style, so that it will apply to all theorem-style structures
% that are defined after this command
\theoremstyle{plain}
% Then, for the Assumption, Corollary, Proposition, etc. ``plain'' style is active
% You can add more of these structures to suit your needs
\newtheorem{assumption}{Assumption}
\newtheorem{corollary}{Corollary}
\newtheorem{definition}{Definition}
\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\newtheorem{remark}{Remark}
\newtheorem{theorem}{Theorem}
% (5) Caption headings are bold and small
\usepackage[bf,small,nooneline,normal]{caption2}
\renewcommand*{\captionlabeldelim}{\nobreak}
\renewcommand*\captionlabeldelim{.}
\renewcommand{\captionfont}{\bfseries}
% (6) Table numbers are uppercase roman
\renewcommand{\thetable}{\Roman{table}}
% (7) First paragraphs are indented except the very first (unlabeled) section
\usepackage{indentfirst}
% (8) Change the formatting of the section header for Abstract
\renewcommand{\abstractname}{\bf \small ABSTRACT}
% (9) Change the formatting of the section header for References
\renewcommand{\refname}{\bf \small REFERENCES}
% (10) To move footnotes to the end of the text
\usepackage{endnote}
\renewcommand{\footnote}{\endnote}
\renewcommand{\notesname}{\bf Footnotes}
答案1
这样的任务往往非常棘手,因为有很多事情可能出错。
我建议使用编辑器的搜索和替换功能:
如果序言中的内容不超过 25 行,我会将所有文件复制到一个大文件中。如何执行此操作取决于您的操作系统,但谷歌提供了许多答案。对于 Windows,例如请参见此处:https://superuser.com/a/453806
您的文档中现在有 25 行\documentclass...
。您的编辑器可能提供了替换文本的功能。替换该行,然后对序言的所有其他行重复此操作。(是的,每次只替换一行,否则您可能需要正则表达式……)。
不要忘记\maketitle
也删除。
\title{
然后用替换字符串\chapter{
。
写一个新的序言。
然后你必须将所有新命令转移到新的前导码中。除了手动操作之外,我不知道如何解决这个问题。
添加文档的开始和结束。
编译...