
我正在嘗試將我大學的 TeX 模板導入到我的 LyX 中,在嘗試這個之前我已經寫好了我的論文,我嚇壞了。
完整的模板可以從https://www2.vmi.ei.tum.de/templates/;我用thesis-current-utf8.zip
。
透過將來源複製到使用者資料夾等。
我可以選擇文件樣式article
(tum)並稍加修改,tum.cls
刪除hyperref
不適用於 LyX 的部分。我仍然需要以某種方式匯入frontpage.tex
相當複雜的文件(見下文)。
但我無法將此文件匯入 LyX。它給了我很多
Undefined Control Sequence
錯誤。
也許你可以嘗試導入下面的 TeX 檔案並顯示它並告訴我出了什麼問題。不要介意圖片或使用下載連結。這真的很棒,因為我已經為此工作了一周!
\RestoreLanguage
\ifthenelse{\equal{\MyType}{PhD}}{%
\GeneratePhDHead\\[8ex]
%%--------------------Dissertations-Deckblatt----------------------------------------------------
\onehalfspacing
{\centering
\color{tumblue}{\huge\bf{\insertTitle \par \parindent 0pt }}
}
\vspace{2cm}
\begin{center}
{\Large{\bf{\insertAuthor}}}\\[6ex]
Vollständiger Abdruck der von der Fakultät für Elektrotechnik und Informationstechnik der Technischen Universität München zur Erlangung des akademischen Grades eines\\[3ex]
\textbf{Doktor-Ingenieurs (Dr.-Ing.)}\\[3ex]
genehmigten Dissertation.
\end{center}
\vfill
{\begin{tabular}{ll}
Vorsitzender & \insertVorsitzender \\[1ex]
Prüfer der Disseration: & 1. \insertProfessorFirst \\
& 2. \insertProfessorSecond
\end{tabular}}\\[6ex]
{Die Disseration wurde am \insertDateEnd\ bei der Technischen Universität München eingereicht und durch die Fakultät für Elektrotechnik und Informationstechnik am \insertDateBegin\ angenommen.}\\
\cleardoublepage
%%-------------------Ende Dissertation Deckblatt----------------------------
}{%
%%-------------------Studienarbeiten Deckblatt und erste Seiten----------------------------
%
\GenerateHead
\\[8ex]
%---------------------------------Thema und Autor--------------------------------
\onehalfspacing
%%%%%%%%%%%%%%
%{\color{tumblue}{\huge\bf{\insertTitle\par\ }}}\\[5ex]
%print1
%{\color{tumblue}{\huge\bf{\insertFirstTitle }}} \\[3ex] %\par\ %\parindent 0pt
%{\color{tumblue}{\huge\bf{\insertSecondTitle\par\ }}} \\[5ex]
%print2
%{\color{tumblue}{\huge\bf{\insertFirstTitle \par\ }}} \\[0ex] % %
%{\color{tumblue}{\Large\bf{\insertSecondTitle\par\ }}} \\[5ex]
%print3
%{\color{tumblue}{\huge\bf{\insertFirstTitle \par \parindent 0pt }}} %\\[0ex] % %
%{\color{tumblue}{\Large\bf{\insertSecondTitle\par\ }}} \\[5ex]
%print4
%{\color{tumblue}{\huge\bf{\insertFirstTitle }}} \\[4ex]
%{\color{tumblue}{\huge\bf{\insertSecondTitle\par\ }}} \\[5ex]
%print5
{\color{tumblue}{\huge\textbf{\insertFirstTitle \par \parindent 0pt }}} \vspace{0.75\baselineskip}
{\color{tumblue}{\LARGE\textbf{\insertSecondTitle\par\ }}} \\[5ex]
{\Large{\bf{\insertAuthor}}}\\[3ex]
{\Large{{\insertType}}}\\[5ex]
\ \\
\vfill
%-----------------------------weitere Angaben -----------------------------------
\SelectByReport{%
\begin{tabular}{ll}
\intlAuthor: & \insertTableAuthor \\
\intlGroup: & \insertGroup \\
\intlProfessor: \hspace*{2cm} & \insertProfessor \\
\intlAdvisor: & \insertAdvisor \\
\intlSemester: & \insertSemester \\
\intlDateEnd: & \insertDateEnd
\end{tabular}}
{%
\begin{tabular}{ll}
\intlAuthor: & \insertTableAuthor \\
\intlLocation: & \insertStreet \\
& \insertTown \\
\intlNumber: & \insertMatrikelNr \\
\intlProfessor: \hspace*{2cm} & \insertProfessor \\
\intlAdvisor: & \insertAdvisor \\
\intlDateStart: & \insertDateBegin \\
\intlDateEnd: & \insertDateEnd
\end{tabular}}
\cleardoublepage
%-----------------------
%echwechgema an mengen clearpage baigesaat
\SelectIfPartner{%
\GenerateHead
\ \\[-2ex]
% %------------------------- Beteiligte Organisationen -----------------
\singlespacing\noindent%%%%%%%%%%%%%%%
{\color{tumblue}{\huge\bf{\intlOrgans}}}\\
\parbox[c]{2.5cm}{\includegraphics{\insertInstituteLogo}}
\parbox[c]{13.5cm}{\insertFullAddress}
\ \\[5ex]%
\parbox[c]{2.5cm}{ \includegraphics[height=1cm]{\insertIPLogo}}
\parbox[c]{13.5cm}{\insertFullIPAddress}
\\[5ex]\par
% %------------------------- Eidesstattliche Erklaerung -----------------
{\color{tumblue}{\huge\bf{\intlStatement}}}\\[5ex]
\SelectByLanguage{I declare under penalty of perjury, that I wrote this \insertType\ entitled}
{Hiermit erkl\"are ich an Eides statt, dass ich diese \insertType\ zum Thema}\\[3ex]
{\color{tumblue}{\bf{\insertTitle}}}
\\[3ex]
\SelectByLanguage{by myself and that I used no other than the specified sources and tools.}
{selbstst\"andig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel verwendet habe.}
\\[7ex]
\SelectByLanguage{\insertUniSmallTown, \today}{\insertUniSmallTown, den \insertDateEnd}\\[-6ex]
\begin{flushright}{\rule{7cm}{0.5pt}}\\{\footnotesize{\insertAuthor}}\end{flushright}
\ \\[-8ex]\\\vfill\noindent
\insertAuthor\\
\insertStreet \\
\insertTown \\
\clearpage
%%%%%%%%%%%%%%%%%%
\onehalfspacing
}{%
\GenerateHead
\ \\[4ex]
% %------------------------- Beteiligte Organisationen -----------------
\singlespacing\noindent%%%%%%%%%%%%%%%
\ \\[20ex]%
% %------------------------- Eidesstattliche Erklaerung -----------------
{\color{tumblue}{\huge\bf{\intlStatement}}}\\[5ex]
\SelectByLanguage{I declare under penalty of perjury that I wrote this \insertType\ entitled}
{Hiermit erkl\"are ich an Eides statt, dass ich diese \insertType\ zum Thema}\\[3ex]
{\color{tumblue}{\bf{\insertTitle}}}
\\[3ex]
\SelectByLanguage{by myself and that I used no other than the specified sources and tools.}
{selbstst\"andig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel verwendet habe.}
\\[7ex]
\SelectByLanguage{\insertUniSmallTown, \today}{\insertUniSmallTown, den \insertDateEnd}\\[-6ex]
\begin{flushright}{\rule{7cm}{0.5pt}}\\{\footnotesize{\insertAuthor}}\end{flushright}
\ \\\vfill\noindent
\insertAuthor\\
\insertStreet \\
\insertTown \\
\clearpage
%%%%%%%%%%%%%%%%%%
\onehalfspacing
}
\cleardoublepage
%%----------------Ende Studienarbeiten Deckblatt und erste Seiten------------------%
}
答案1
一般來說,而不是導入“.tex”文件如“首頁.tex”到 LyX 中,還可以包含一個“.tex”文件作為子文檔。
讓我們看看這裡的LaTeX情況。主檔案“thesis.tex”使用文件類別“tum.cls”,透過 間接定義多個巨集\Define....
,並透過 包含檔案“frontpage.tex” \input
。因此,要將首頁快速轉換為 LyX 文檔
我們將類別樣式檔案「tum.cls」複製到 LaTeX 序言中,並刪除連接到文檔類別的行(或使其成為註釋)(例如,
\ProvidesClass
,\LoadClass
,\DeclareOption
, ...),並刪除\usepackage
否則的套件( )由LyX 提供。我們將巨集的設定
\Define...
從主檔案「thesis.tex」複製到結尾LaTeX 序言的內容,即\DefineType{Diplom} ... \DefineIPLogo{logos/FG_VMI_RGB}
(當然,也要設定正確的值。)
我們將“frontpage.tex”作為子文檔包含到 LyX 中,並包含類型“Input”(“插入 > 文件 > 子文檔...”)。
此外,如果不在標準 LyX 發行版中的文檔類別“article (tum)”轉換為 LaTeX 類別“article”,那麼它似乎是錯誤的選擇。類別“tum.cls”基於類別“scrreprt”。這對應於 LyX 中的「報告(KOMA-Script)」。
最後,為了編譯和檢視 LyX 文檔,我們使用「檢視 PDF (pdflatex)」(因為 tum 範本使用 pdflatex)。
(順便說一句,對於這種情況,建立一個 LyX 佈局檔案是有意義的。有關此的更多資訊可以在「安裝新文件類別」一章中的 LyX 選單「說明 > 自訂」中找到。)