使用 Latex 模板在 Lyx 中撰写论文——我做错了什么?

使用 Latex 模板在 Lyx 中撰写论文——我做错了什么?

我希望用 Lyx 撰写我的论文,因为它的所有文档处理功能都给我留下了深刻的印象。

我在这里找到了我大学论文的 Latex 模板:http://www.cs.columbia.edu/mice/c/d.php?d=109

该模板包含一组 .tex、.bst 和 .sty 文件以及一个简单的 Makefile。运行后make会生成一个漂亮的 PDF,看起来就像一篇基本论文一样。

现在我该如何让 Lyx 很好地处理这一切?首先,我没有看到任何处理 Makefile 的东西。

我是想实现梦想吗?

答案1

我认为以下内容应该涵盖了大部分内容。如果有任何遗漏或错误,请告诉我。

文件组织

named.sty将其放置named.bst在与您的文件相同的文件夹中.lyx

文档类别选项

转到文档 --> 设置 --> 文档类别,选择报告从课程列表中,添加

11pt,openright,twoside,letterpaper

风俗选项。(模板中其实有openright,oneside,但前者对后者没有影响,所以我改用了twoside。我还删除了该onecolumn选项。)

在此处输入图片描述

前言

将以下代码粘贴到文档 --> 设置 --> LaTeX 前言中。注意:

  • 您当然应该修改前三行,添加您的头衔、姓名和年份。

  • 我删除了该epsfig包,认为它现在不常用,但graphicx无论如何 LyX 都会加载(建议用于处理外部图像)。

  • 我删除了dvipdfmletterpaper选项hyperref。您可能会使用 pdfLaTeX 进行编译,导致第一个选项错误。后者未使用。

  • 我将一些内容从文档移到了序言中,包括页面样式的定义(myplain,我将名称从 改为plain)和\renewcommand\contentsname{Table of Contents}

    \newcommand{\thesistitle}{Thesis title}
    \newcommand{\thesisauthor}{Author's name}
    \newcommand{\thesisyear}{20XX}
    
    %%%
    %%% Packages
    %%%
    \usepackage{named}
    \usepackage{fancyhdr}
    \usepackage{afterpage}
    
    %
    % We use the hyperref package and customize it for optimal PDF 
    %
    \usepackage[
       pdftitle={\thesistitle},
       pdfauthor={\thesisauthor},
       pdfpagemode={UseOutlines},
       bookmarks,
       bookmarksopen=true,
       pdfstartview={FitH},
       bookmarksnumbered=true]{hyperref}
    
    %%%
    %%% Margins
    %%%
    \paperwidth=8.5in
    \paperheight=11in
    
    % 1in + hoffset + oddsidemargin + textwidth + marginparsep + marginparwidth
    % For PhD at Columbia we have single side theses and 1.5in left margin
    % The settings below leave 1.5 inch margin at the left and 1 inch at the right 
    % for US Letter paper
    \setlength{\hoffset}{0.0in}
    \setlength{\oddsidemargin}{.5in}
    \setlength{\textwidth}{6in}
    \setlength{\evensidemargin}{0mm}
    
    % 1in + voffset + topmargin + headheight + headsep + textheight + footskip 
    % For PhD thesis we also need an extra inch at the bottom
    % 1inch = 72 pt
    \setlength{\voffset}{0.0in}
    \setlength{\topmargin}{.0in}
    \setlength{\headheight}{14pt}
    \setlength{\headsep}{22pt}
    \setlength{\textheight}{8.5in}
    \setlength{\footskip}{0pt}
    
    %%%
    %%% Spacing
    %%%
    \newcommand{\singlespace}{\renewcommand{\baselinestretch}{1.15} \small \normalsize}
    \newcommand{\oneandhalfspace}{\renewcommand{\baselinestretch}{1.3} \small \normalsize}
    \newcommand{\doublespace}{\renewcommand{\baselinestretch}{1.5} \small \normalsize}
    \newcommand{\normalspace}{\doublespace}
    \footnotesep=1\baselineskip
    
    %%%
    %%% Counters depth
    %%%
    \setcounter{secnumdepth}{3}
    \setcounter{tocdepth}{3}
    
    %%%
    %%% Title page.
    %%%
    \newcommand{\thesistitlepage}{
        \normalspace
        \thispagestyle{empty}
        \begin{center}
            \textbf{\LARGE \thesistitle} \\[1cm]
            \textbf{\LARGE \thesisauthor} \\[8cm]
            Submitted in partial fulfillment of the \\
            requirements for the degree \\
            of Doctor of Philosophy \\
            in the Graduate School of Arts and Sciences \\[4cm]
            \textbf{\Large COLUMBIA UNIVERSITY} \\[5mm]
            \thesisyear
        \end{center}
        \clearpage
    }
    
    %%%
    %%% Copyright page.
    %%%
    \newcommand{\thesiscopyrightpage}{
        \thispagestyle{empty}
        \strut \vfill
        \begin{center}
          \copyright \thesisyear \\
          \thesisauthor \\
          All Rights Reserved
        \end{center}
        \cleardoublepage
    }
    
    %%%
    %%% Abstract page.
    %%%
    \newcommand{\thesisabstract}{
        \thispagestyle{empty}
        \begin{center}
        \textbf{\LARGE ABSTRACT} \\[1cm]
         \textbf{\LARGE \thesistitle} \\[1cm]
         \textbf{\LARGE \thesisauthor} \\[1cm]
        \end{center}
        \input{abstract}
        \cleardoublepage
    }
    
    %%%
    %%% Miscellaneous
    %%%
    \newcommand{\draft}{
        \renewcommand{\normalspace}{\singlespace}
        \normalspace
        \chapter*{Draft. Version \today}
    \clearpage }
    
    
    \renewcommand{\contentsname}{Table of Contents}
    
    
    % We change the pagestyle 
    \fancypagestyle{myplain} {%
    \fancyhf{}
    \fancyhead[LE,RO]{\thepage}
    \fancyhead[RE,LO]{\itshape \leftmark}
    \renewcommand{\headrulewidth}{0pt}
    }
    

在文档中

  1. 首先添加 ERT ( Ctrl+ L)

    % For the first pages we do not have numbering
    
    \pagestyle{empty}
    
    \thesistitlepage
    \thesiscopyrightpage
    \thesisabstract
    % In the "roman-numbered" section of the thesis, we have numbers at the bottom % and we have to reduce the textheight of the text to make space for the number
    \pagenumbering{roman}
    \pagestyle{plain}
    
    \setlength{\footskip}{0.5in}
    
  2. ERT 之后,通过插入 --> 列表/目录菜单添加目录、图表列表和表格列表。

  3. 添加一个未编号的章节,将其命名为致谢并把它们写在这里。

    (这与模板中的不完全相同。)

  4. 如果您想要献词页,请执行以下操作:

    i. 插入 --> 格式化 --> 清除双页

    ii. 插入 --> 格式 --> 垂直间距。选择 VFill,勾选保护

    iii. 写下你的献词。

    iv. 添加第二个 VFill,如步骤 i)。

    v. 插入-->格式化-->清除双页

  5. 添加新的 ERT

    \pagenumbering{arabic}
    
    % In the "arabic" section of the thesis, we do not have numbers at  the
    % bottom and we want to use the full length of the page to avoid vbox 
    % underfulls. We use the fancyheaders package to adapt the headers 
    % according to the  Columbia requirements. 
    
    \setlength{\textheight}{8.5in}
    \setlength{\footskip}{0in}
    
    \pagestyle{myplain}
    
  6. 写下全部内容。

参考书目

在参考书目应该出现的位置,执行插入 --> 列表/目录 --> BibTeX 参考书目。选择您的.bib文件,然后从风格下拉菜单,选择命名

完整示例

下面的代码实际上是一个.lyx文件,您可以复制文本,将其另存为something.lyx并在 LyX 中打开它。它由 LyX 2.0.6 生成,因为 LyX 2.1 尚未出现在 Ubuntu 的存储库中,而且我还没有手动更新。(反正我从来没有真正使用过 LyX。)

#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass report
\begin_preamble
\newcommand{\thesistitle}{Thesis title}
\newcommand{\thesisauthor}{Author's name}
\newcommand{\thesisyear}{20XX}

%%%
%%% Packages
%%%
\usepackage{amsmath}
\usepackage{named}
\usepackage{fancyhdr}
\usepackage{afterpage}

%
% We use the hyperref package and customize it for optimal PDF 
%
\usepackage[pdftitle={\thesistitle},pdfauthor={\thesisauthor},pdfpagemode={UseOutlines},letterpaper,bookmarks,bookmarksopen=true,pdfstartview={FitH},bookmarksnumbered=true,]{hyperref}

%%%
%%% Margins
%%%
\paperwidth=8.5in
\paperheight=11in

% 1in + hoffset + oddsidemargin + textwidth + marginparsep + marginparwidth
% For PhD at Columbia we have single side theses and 1.5in left margin
% The settings below leave 1.5 inch margin at the left and 1 inch at the right 
% for US Letter paper
\setlength{\hoffset}{0.0in}
\setlength{\oddsidemargin}{.5in}
\setlength{\textwidth}{6in}
\setlength{\evensidemargin}{0mm}

% 1in + voffset + topmargin + headheight + headsep + textheight + footskip 
% For PhD thesis we also need an extra inch at the bottom
% 1inch = 72 pt
\setlength{\voffset}{0.0in}
\setlength{\topmargin}{.0in}
\setlength{\headheight}{14pt}
\setlength{\headsep}{22pt}
\setlength{\textheight}{8.5in}
\setlength{\footskip}{0pt}

%%%
%%% Spacing
%%%
\newcommand{\singlespace}{\renewcommand{\baselinestretch}{1.15} \small \normalsize}
\newcommand{\oneandhalfspace}{\renewcommand{\baselinestretch}{1.3} \small \normalsize}
\newcommand{\doublespace}{\renewcommand{\baselinestretch}{1.5} \small \normalsize}
\newcommand{\normalspace}{\doublespace}
\footnotesep=1\baselineskip

%%%
%%% Counters depth
%%%
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

%%%
%%% Title page.
%%%
\newcommand{\thesistitlepage}{
    \normalspace
    \thispagestyle{empty}
    \begin{center}
        \textbf{\LARGE \thesistitle} \\[1cm]
        \textbf{\LARGE \thesisauthor} \\[8cm]
        Submitted in partial fulfillment of the \\
        requirements for the degree \\
        of Doctor of Philosophy \\
        in the Graduate School of Arts and Sciences \\[4cm]
        \textbf{\Large COLUMBIA UNIVERSITY} \\[5mm]
        \thesisyear
    \end{center}
    \clearpage
}

%%%
%%% Copyright page.
%%%
\newcommand{\thesiscopyrightpage}{
    \thispagestyle{empty}
    \strut \vfill
    \begin{center}
      \copyright \thesisyear \\
      \thesisauthor \\
      All Rights Reserved
    \end{center}
    \cleardoublepage
}

%%%
%%% Abstract page.
%%%
\newcommand{\thesisabstract}{
    \thispagestyle{empty}
    \begin{center}
    \textbf{\LARGE ABSTRACT} \\[1cm]
     \textbf{\LARGE \thesistitle} \\[1cm]
     \textbf{\LARGE \thesisauthor} \\[1cm]
    \end{center}
    \input{abstract}
    \cleardoublepage
}

%%%
%%% Miscellaneous
%%%
\newcommand{\draft}{
    \renewcommand{\normalspace}{\singlespace}
    \normalspace
    \chapter*{Draft. Version \today}
\clearpage }


\renewcommand{\contentsname}{Table of Contents}
\setcounter{tocdepth}{2}


% We change the pagestyle 
\fancypagestyle{myplain} {%
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE,LO]{\itshape \leftmark}
\renewcommand{\headrulewidth}{0pt}
}
\end_preamble
\options 11pt,openright,twoside,letterpaper,onecolumn
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout

% For the first pages we do not have numbering
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
pagestyle{empty}
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
thesistitlepage
\end_layout

\begin_layout Plain Layout


\backslash
thesiscopyrightpage
\end_layout

\begin_layout Plain Layout


\backslash
thesisabstract
\end_layout

\begin_layout Plain Layout

% In the "roman-numbered" section of the thesis, we have numbers at the
 bottom % and we have to reduce the textheight of the text to make space
 for the number
\end_layout

\begin_layout Plain Layout


\backslash
pagenumbering{roman}
\end_layout

\begin_layout Plain Layout


\backslash
pagestyle{plain}
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
setlength{
\backslash
footskip}{0.5in}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset CommandInset toc
LatexCommand tableofcontents

\end_inset


\end_layout

\begin_layout Standard
\begin_inset FloatList figure

\end_inset


\end_layout

\begin_layout Standard
\begin_inset FloatList table

\end_inset


\end_layout

\begin_layout Chapter*
Acknowledgements
\end_layout

\begin_layout Standard
So long and thanks for all the fish.
\end_layout

\begin_layout Standard
\begin_inset Newpage cleardoublepage
\end_inset


\end_layout

\begin_layout Standard
\begin_inset VSpace vfill*
\end_inset


\end_layout

\begin_layout Standard
\align center
Dedication
\end_layout

\begin_layout Standard
\begin_inset VSpace vfill*
\end_inset


\end_layout

\begin_layout Standard
\begin_inset Newpage cleardoublepage
\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
pagenumbering{arabic}
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout

% In the "arabic" section of the thesis, we do not have numbers at  the
\end_layout

\begin_layout Plain Layout

% bottom and we want to use the full length of the page to avoid vbox 
\end_layout

\begin_layout Plain Layout

% underfulls.
 We use the fancyheaders package to adapt the headers 
\end_layout

\begin_layout Plain Layout

% according to the  Columbia requirements.

\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
setlength{
\backslash
textheight}{8.5in}
\end_layout

\begin_layout Plain Layout


\backslash
setlength{
\backslash
footskip}{0in}
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
pagestyle{plain}
\end_layout

\end_inset


\end_layout

\begin_layout Chapter
Intro
\end_layout

\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "chap:intro"

\end_inset


\end_layout

\begin_layout Standard
This is about stuff.
\end_layout

\begin_layout Part
Stuff
\end_layout

\begin_layout Chapter
Something
\end_layout

\begin_layout Standard
Etc.
\begin_inset CommandInset citation
LatexCommand cite
key "Grosz_and_Sidner_1986"

\end_inset


\end_layout

\begin_layout Part
Appendices
\end_layout

\begin_layout Standard
\begin_inset CommandInset bibtex
LatexCommand bibtex
bibfiles "refs"
options "named"

\end_inset


\end_layout

\end_body
\end_document

相关内容