
我對 LaTeX 比較陌生,但我一直在嘗試使用它來寫我的碩士論文。我一直在使用 pgfplots 套件創建幾個繪圖。但是,當我嘗試將這些圖形插入圖形環境以引用它們並添加標題時,我遇到了錯誤。奇怪的是,它們在這種環境之外運作得很好。以下是其中一個圖的範例:
\documentclass[a4paper,12pt,oneside,onecolumn,final,fleqn]{repUERJ}
% ---
% Packages
% ---
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{amsmath}
\usepackage{chemformula}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{trees}
\pgfplotsset{compat=newest}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{spy}
\usepackage{textcomp} %trademark
% ---
% College model
% ---
\usepackage[frame=no,algline=yes,font=default]{repUERJformat}
\usepackage{repUERJpseudocode}
% ---
% Citations packages
% ---
\usepackage[alf]{abntex2cite}
%newcommands
\newcommand{\inputgraph}[2]{% #1 = file, #2 = graph name %https://tex.stackexchange.com/questions/378607/using-input-to-insert-a-section-of-a-document-into-another
\long\def\GRAPH ##1#2 {}%
\input{#1}
}
\let\ENDGRAPH\endinput
\begin{document}
\begin{figure}
\caption{Caption}
\label{fig:enter-label}
\begin{tikzpicture} %Plot
\begin{axis}[
title={},
xlabel={Time (days)},
ylabel={UFC/g},
xmin=0, xmax=30,
legend pos= outer north east,
legend style={font=\tin},
grid style=dashed,
]
\addplot[
color=cyan,
mark=square,
error bars/.cd, y dir=both, y explicit
]
coordinates {
(7,56400) +- (0,90)
(14,9730) +- (0,90)
(21,1570) +- (0,70)
(28,12500) +- (0,90)
};
\addplot[
color=red,
mark=square,
error bars/.cd, y dir=both, y explicit
]
coordinates {
(7,0)
(14,0)
(21,0)
(28,0)
};
\legend{Blank, \ch{H2SO4}}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
正如我所提到的,我是 LaTeX 的新手,所以我可能沒有在這裡使用最優雅的解決方案。我正在使用各種軟體包來使文字符合大學格式。如果看起來有些混亂,我深感抱歉。
答案1
請參見我剛剛被要求編寫一個最小工作範例(MWE),那是什麼?了解如何編寫 MWE。
當你寫 時legend style={font=\tin},
,你的意思可能是:
legend style={font=\tiny},