TikZ 兼容性

TikZ 兼容性

TikZ 包是否与其他 LaTeX 包不兼容?我的代码前言如下。当我加载 TikZ 包时,我无法编译我的文件。任何帮助都将不胜感激!

\documentclass[english,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
  \usepackage[sc,osf]{mathpazo} 
\usepackage[dvipsnames]{xcolor}

%% Set Paper Margin
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}

%% Page Style/Numbering 
\usepackage{fancyhdr} % for making fancy header/footer
\usepackage{lastpage} % for page numbering style
  \pagestyle{fancy}
  %%"Page # of ##" -- Comment out to get default page numbering
  \cfoot{Page \thepage\ of \pageref*{LastPage}} % text in center footer
  %% Header
  \lhead{} % text in left header
  \rhead{} % text in right header
  \chead{} % text in center header
  \renewcommand{\headrulewidth}{0pt} % border line in header
  %% Set Line Spacing
  \usepackage{setspace}
  \onehalfspacing % Default line space is set to 1.5

%% Math Packages
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{esint} % use new integral symbols
\usepackage{nicefrac}
  %% New Math Commands
  \DeclareMathOperator*{\argmax}{argmax}
  \DeclareMathOperator*{\argmin}{argmin}
  %% Defining theorem environments
  \theoremstyle{definition}
  \newtheorem{definition}{Definition}
  \providecommand*{\definitionautorefname}{Definition}
  \newtheorem{assumption}{Assumption}
  \providecommand*{\assumptionautorefname}{Assumption}

%% Other Packages
\usepackage{graphicx}
\usepackage{tikz}
\usepackage[hypcap]{caption}
\usepackage[labelformat=simple]{subcaption}
  % autoref as "Fig 1(a)" instead of "Fig 1a"
  \renewcommand\thesubfigure{(\alph{subfigure})} 

%% BibTex
\usepackage[authoryear]{natbib}
  % Defines citations with possessives "Author's (year)"
  \def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}

%% Hyperlinks and PDF Properties
\usepackage[pagebackref]{hyperref}
\hypersetup{pdftitle={Cheap Talk: A Review},%
pdfauthor={Kevin Chen},pdfstartview=FitH,%
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,%
breaklinks=true,,unicode=true,%
colorlinks=true,citecolor=,linkcolor=}
  \renewcommand*{\backref}[1]{[p. #1]} % add [p. ] to backref

答案1

mathtools加载和修改amsmathsubcaption负载caption和 TikZ 加载xcolorgraphicx默认情况下。

此文件亦无错误。

\documentclass[english,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage[sc,osf]{mathpazo} 
\usepackage[dvipsnames]{xcolor}

%% Set Paper Margin
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}

%% Page Style/Numbering 
\usepackage{fancyhdr} % for making fancy header/footer
\usepackage{lastpage} % for page numbering style
  \pagestyle{fancy}
  %%"Page # of ##" -- Comment out to get default page numbering
  \cfoot{Page \thepage\ of \pageref*{LastPage}} % text in center footer
  %% Header
  \lhead{} % text in left header
  \rhead{} % text in right header
  \chead{} % text in center header
  \renewcommand{\headrulewidth}{0pt} % border line in header
  %% Set Line Spacing
  \usepackage{setspace}
  \onehalfspacing % Default line space is set to 1.5

%% Math Packages
\usepackage{amsthm,amsmath,amssymb,mathtools,esint,nicefrac}
  %% New Math Commands
  \DeclareMathOperator*{\argmax}{argmax}
  \DeclareMathOperator*{\argmin}{argmin}
  %% Defining theorem environments
  \theoremstyle{definition}
  \newtheorem{definition}{Definition}
  \providecommand*{\definitionautorefname}{Definition}
  \newtheorem{assumption}{Assumption}
  \providecommand*{\assumptionautorefname}{Assumption}

%% Other Packages

\usepackage{graphicx,tikz}
\usepackage{tikz}
\usepackage[hypcap]{caption}
\usepackage[labelformat=simple]{subcaption}
  % autoref as "Fig 1(a)" instead of "Fig 1a"
  \renewcommand\thesubfigure{(\alph{subfigure})} 

%% BibTex
\usepackage[authoryear]{natbib}
  % Defines citations with possessives "Author's (year)"
  \def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}

%% Hyperlinks and PDF Properties
\usepackage[pagebackref]{hyperref}
\hypersetup{pdftitle={Cheap Talk: A Review},%
pdfauthor={Kevin Chen},pdfstartview=FitH,%
bookmarksopenlevel=2,%
breaklinks=true,unicode=true,%
colorlinks=true,citecolor=,linkcolor=}
  \renewcommand*{\backref}[1]{[p. #1]} % add [p. ] to backref


\begin{document}
\begin{tikzpicture}
    \shade (0,0) rectangle(3,3);
    \draw[ultra thick,red] (0,0) -- (3,1);
\end{tikzpicture}

\end{document}

相关内容