尝试执行此操作时:\usepackage [ table ]{ xcolor }
出现此错误:Latex 错误:包 xcolor 的选项冲突
这是我的序言
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{setspace}\singlespacing
\usepackage{multirow}
\usepackage{fancyvrb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[a4paper,margin=0.65in]{geometry}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{placeins}
\usepackage{titling}
\setlength{\parskip}{1em}
\setlength{\parindent}{0em}
\usepackage{chemfig}
\usepackage{subfig}
\setchemfig{atom sep=2em}
\usepackage{tikz}
\usepackage{array}
\usepackage[table]{xcolor}
\begin{document}
\input{Title}
\input{Introduction}
\input{Background information}
\input{Methodology}
\input{Raw Data}
\input{Proccessed Data}
\input{Results}
\input{Discussion}
\input{Limitations and Improvements}
\input{Bibliography}
\end{document}
这是我想突出显示第一行的表格\rowcolor{blue!10}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Full name of chemical compound & Chemical formula \\
\hline
Potassium Iodine & KI \\
\hline
Potassium Hydroxide & KOH \\
\hline
Sodium Thiosulfate & $\text{Na}_2\text{S}_2\text{O}_3$ \\
\hline
Sulfuric Acid & $\text{H}_2\text{SO}_4$ \\
\hline
Manganese (II) Sulfate & $\text{MnSO}_4$ \\
\hline
Starch Indicator Solution & $\text{C}_6\text{H}_{12}\text{O}_5$ \\
\hline
\end{tabular}
\end{center}
\captionof{table}{Chemical names and respective formulas for Winklers Method}
知道问题是什么吗?
答案1
让我继续对问题的评论:
- 每个包应该只加载一次
- 一些包也会加载其他包:例如不带选项
tikz
加载xcolor
- 如果在这种情况下您需要加载包的选项,那么您应该在隐式加载之前加载它。
- 在您的示例中,您通过 加载
caption
两次,并xcolor
通过 加载一次,并在 之后明确tikz
使用选项加载一次。table
tikz
- 离题:对于化学公式我会使用
mhchem
包:
\documentclass{article}
\usepackage[a4paper,margin=0.65in]{geometry}
\usepackage[version=4]{mhchem}
\usepackage[font=small,labelfont=bf]{caption} % should be loaded only once
\usepackage[table]{xcolor} % observe order
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tabular}{|c|c|}
\hline
\rowcolor{blue!10}
Full name of chemical compound
& Chemical formula \\
\hline
Potassium Iodine & KI \\
\hline
Potassium Hydroxide & \ce{KOH} \\
\hline
Sodium Thiosulfate & \ce{Na2S2O3} \\
\hline
Sulfuric Acid & \ce{H2SO4} \\
\hline
Manganese (II) Sulfate
& \ce{MnSO4} \\
\hline
Starch Indicator Solution
& \ce{C6H12O5} \\
\hline
\end{tabular}
\captionof{table}{Chemical names and respective formulas for Winklers Method}
\end{center}
\end{document}