我使用运行我的 Latex 文件pdflatex
并收到以下错误消息:
! Package babel Error: Unknown language `american'. Either you have
(babel) misspelled its name, it has not been installed,
(babel) or you requested it in a previous run. Fix its
name,
(babel) install it or just rerun the file, respectively.
See the babel package documentation for explanation.
Type H <return> for immediate help.
...
l.20 \select@language{american}
我的 .tex 文件以以下内容开头:
\documentclass[a4paper,12pt,ngerman]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{fancyhdr}
\usepackage{a4}
\usepackage[ngerman]{babel}
...
我删除了 american babel 包并用 ngerman 包替换它。之后我收到了包 babel 错误,尽管 american 包已被删除。
我怎样才能修复这个错误并编译代码?
答案1
我删除了创建的 .aux 文件,pdflatex <filename>
再次运行后不再出现错误,并且 PDF 已正确构建。