对于我的论文,我想使用数学包,但当我将其导入到我的 settings.sty 文件中时,我收到 100 多个错误。我已经读过我应该在 hyperref 之前导入它,但错误仍然存在。也许有人可以在这里帮助我?
我的设置文件的重要部分如下所示:
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{ {images/} } %seeting the path for all images
\usepackage{tocbibind}
\usepackage[german]{babel}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{float}
\usepackage{setspace}
\usepackage{ragged2e}
\usepackage{mathptmx}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.multipart,shapes, calc}
\usepackage{caption}
\usepackage[a4paper, left=3cm, right=2.5cm, top=2.5cm, bottom=2cm]{geometry}
\usepackage{acro}
\usepackage{array}
\usepackage{longtable}
\usepackage{supertabular}
\usepackage{amsmath} %HERE IS THE PACKAGE CAUSING PROBLEM!
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black }
\usepackage{cleveref}
\usepackage{fancyhdr}
\usepackage{csquotes}
\usepackage[
backend=biber,
style=numeric,
citestyle=numeric,
abbreviate=false,
autocite=footnote,
maxcitenames=3
]{biblatex}
\addbibresource{literatur.bib}
\DeclareNameAlias{default}{family-given/given-family}
\DeclareLanguageMapping{german}{german-apa}
\renewcommand*{\multinamedelim}{\addcomma\space}
\renewcommand*{\finalnamedelim}{\addspace\bibstring{and}\addspace}
\usepackage{tocloft}
%settings for image in right top corner
\usepackage[T1]{fontenc}
\usepackage{eso-pic}
\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{%
\makebox[\paperwidth][r]{#1}}}
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
%------------ Text Environment --------------------
\newenvironment{text}
{
\begin{justify}
\begin{spacing}{1.2}
}{
\end{spacing}
\end{justify}
}
\usepackage{listings}
\usepackage{xcolor}
\renewcommand\lstlistingname{Quellcode}
\renewcommand\lstlistlistingname{Quellcodeverzeichnis}
\endinput
我的 main.tex 如下所示:
\documentclass[12pt]{article}
\usepackage{settings}
\title{\textbf{Titel}}
\date{}
\begin{document}
\author{}
\section{Section}
\begin{text}
This is some text where I am using equation
\end{text}
答案1
我看到的第一个错误来自裸露的\includegraphics
。我不确定你在尝试什么。
amsmath 错误是因为 amsmath 定义了一个\text
命令,但你的 也定义了一个命令\newenvironment{text}
。如果你想要 amsmath,你需要更改环境的名称。
答案2
产生的错误是
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.3 \includegraphics
includegraphics
因为其中第 3 行的虚假内容settings.sty
应该被删除。
如果删除了,你会得到
! LaTeX Error: Command \text already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.68 }
?
因为你覆盖了标准\text
命令