这是我第一次在 stackoverflow 上发帖,我希望我做得对。
我在大学的 Windows 7 电脑上有一个 LateX 文件。它曾经与 TeXMaker 完美编译。最近,由于大学放暑假,我不得不把它带回家,而我只有一台 Ubuntu 笔记本电脑。我昨天下载了最新版本的 TeX Live - Full 以及使用 TeXMaker 界面sudo apt install
。我试图打开我的文件,但出现错误。我在第 25 行收到“!Extra \fi”错误消息,其中有该行\usepackage[toc,page]{appendix}
,以及大量其他错误消息,例如第 36 行的“!Extra \else。”(\usepackage{textcomp}
)。
我不得不说,安装 TeXLive Full 后没有下载任何软件包(这很奇怪,我认为安装没有下载所有软件包),而且我是 LateX 和 Ubuntu 的完全新手。你们有人知道如何正确编译文件吗?这是导致错误的代码的第一行。
\documentclass[12pt,twoside]{report}
\usepackage{etex}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[a4paper]{geometry}
\usepackage[frenchb]{babel}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{frenchle}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{cases}
\usepackage{eurosym}
\usepackage{ulem}
\usepackage{tikz}
\usepackage[makeroom]{cancel}
\usepackage{hyperref}
\usepackage{sidecap}
\usepackage{listings}
\usepackage{multicol}
\usepackage[toc,page]{appendix}
\usepackage{wrapfig}
\usepackage{tocloft}
\usepackage[ampersand]{easylist}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{underscore}
\usepackage{textcomp}
\usepackage{tikz}
\setlength{\oddsidemargin}{-1.cm}
\setlength{\evensidemargin}{0.cm}
\setlength{\topmargin}{-1.cm}
\setlength{\textheight}{24.cm}
\setlength{\textwidth}{17.cm}
\setlength{\parskip}{2ex}
\setlength{\footnotesep}{2ex}
\setlength{\parindent}{0ex}
\addtolength{\skip\footins}{2ex}
\makeatletter
\def\clap#1{\hbox to 0pt{\hss #1\hss}}%
\def\ligne#1{%
\hbox to \hsize{%
\vbox{\centering #1}}}%
\def\haut#1#2#3{%
\hbox to \hsize{%
\rlap{\vtop{\raggedright #1}}%
\hss
\clap{\vtop{\centering #2}}%
\hss
\llap{\vtop{\raggedleft #3}}}}%
\def\bas#1#2#3{%
\hbox to \hsize{%
\rlap{\vbox{\raggedright #1}}%
\hss
\clap{\vbox{\centering #2}}%
\hss
\llap{\vbox{\raggedleft #3}}}}%
\def\maketitle{%
\setcounter{page}{0}
\thispagestyle{empty}\vbox to \vsize{%
\haut{}{\@blurb}{}
\vfill
\vspace{1cm}
\begin{flushleft}
\usefont{OT1}{ptm}{m}{sl}
\huge \@title
\end{flushleft}
\par
\hrule height 4pt
\par
\begin{flushright}
\usefont{OT1}{phv}{m}{n}
\Large \@author
\par
\end{flushright}
%new commands
\newcommand{\mychapter}[1]{\textcolor{mygrey}{\chapter{\uppercase{#1}}}}
\newcommand{\mychapteretoile}[1]{\textcolor{mygrey}{\chapter*{\uppercase{#1}}}}
\newcommand{\mysection}[1]{\textcolor{myblue}{\section{#1}}}
\newcommand{\mysectionetoile}[1]{\textcolor{myblue}{\section*{#1}}}
\newcommand{\mysubsection}[1]{\textcolor{myblue}{\subsection{#1}}}
\newcommand\crule[3][black]{\textcolor{#1}{\rule{#2}{#3}}}
%renewcommand
\ListProperties(Space=.01cm, Space*=.01cm, Progressive=3ex, Style*=-- ,
\renewcommand{\cftaftertoctitle}{\hrulefill}
\begin{document}
% My doc
\end{document}
我不得不说,这在我使用的 Windows PC 上编译得很完美。
附言:我还有其他错误,例如找不到图形。我很确定我做错了什么。
答案1
发布的文档没有给出标题中的错误,而给出了不同的错误
! Illegal parameter number in definition of \maketitle.
<to be read again>
1
l.86 ...{\textcolor{mygrey}{\chapter{\uppercase{#1
}}}}
?
看起来你省略 }}
了% new commands
如果你添加它们,你会得到
! Paragraph ended before \ListProperties was complete.
<to be read again>
\par
l.98
我不知道该命令应该做什么,所以我把它注释掉了。(但它有一个(
并且没有匹配的)
)
然后你得到错误
-26- Erreur d\'etect\'ee dans frenchle.sty !(voir p.ex. le fichier language.dat
) ! 额外 \else.\bbl@switch ... date#1\endcsname \relax \fi \else \ifbbl@usedategroup \bbl@u... l.102 \begin{document}
?
我不确定您是否可以同时拥有两者frenchle
,[french]{babel}
但无论如何,如果您注释掉该frenchle
包,它就会运行而不会出错。我还注释掉了其他几个 pbsolete 或重复的包
\documentclass[12pt,twoside]{report}
%\usepackage{etex}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[a4paper]{geometry}
\usepackage[frenchb]{babel}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[utf8]{inputenc}
\usepackage{array}
%\usepackage{frenchle}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{cases}
\usepackage{eurosym}
\usepackage{ulem}
\usepackage{tikz}
\usepackage[makeroom]{cancel}
\usepackage{hyperref}
\usepackage{sidecap}
\usepackage{listings}
\usepackage{multicol}
\usepackage[toc,page]{appendix}
\usepackage{wrapfig}
\usepackage{tocloft}
\usepackage[ampersand]{easylist}
\usepackage{xcolor}
%\usepackage{amssymb}
\usepackage{underscore}
\usepackage{textcomp}
\usepackage{tikz}
\setlength{\oddsidemargin}{-1.cm}
\setlength{\evensidemargin}{0.cm}
\setlength{\topmargin}{-1.cm}
\setlength{\textheight}{24.cm}
\setlength{\textwidth}{17.cm}
\setlength{\parskip}{2ex}
\setlength{\footnotesep}{2ex}
\setlength{\parindent}{0ex}
\addtolength{\skip\footins}{2ex}
\makeatletter
\def\clap#1{\hbox to 0pt{\hss #1\hss}}%
\def\ligne#1{%
\hbox to \hsize{%
\vbox{\centering #1}}}%
\def\haut#1#2#3{%
\hbox to \hsize{%
\rlap{\vtop{\raggedright #1}}%
\hss
\clap{\vtop{\centering #2}}%
\hss
\llap{\vtop{\raggedleft #3}}}}%
\def\bas#1#2#3{%
\hbox to \hsize{%
\rlap{\vbox{\raggedright #1}}%
\hss
\clap{\vbox{\centering #2}}%
\hss
\llap{\vbox{\raggedleft #3}}}}%
\def\maketitle{%
\setcounter{page}{0}
\thispagestyle{empty}\vbox to \vsize{%
\haut{}{\@blurb}{}
\vfill
\vspace{1cm}
\begin{flushleft}
\usefont{OT1}{ptm}{m}{sl}
\huge \@title
\end{flushleft}
\par
\hrule height 4pt
\par
\begin{flushright}
\usefont{OT1}{phv}{m}{n}
\Large \@author
\par
\end{flushright}
}}%%%%
%new commands
\newcommand{\mychapter}[1]{\textcolor{mygrey}{\chapter{\uppercase{#1}}}}
\newcommand{\mychapteretoile}[1]{\textcolor{mygrey}{\chapter*{\uppercase{#1}}}}
\newcommand{\mysection}[1]{\textcolor{myblue}{\section{#1}}}
\newcommand{\mysectionetoile}[1]{\textcolor{myblue}{\section*{#1}}}
\newcommand{\mysubsection}[1]{\textcolor{myblue}{\subsection{#1}}}
\newcommand\crule[3][black]{\textcolor{#1}{\rule{#2}{#3}}}
%renewcommand
%\ListProperties(Space=.01cm, Space*=.01cm, Progressive=3ex, Style*=-- ,
\renewcommand{\cftaftertoctitle}{\hrulefill}
\begin{document}
% My doc
\end{document}