
Sou relativamente novo no LaTeX, mas tenho tentado escrever minha tese de mestrado usando-o. Tenho criado vários gráficos usando o pacote pgfplots. No entanto, quando tento inserir esses gráficos no ambiente de figuras para referenciá-los e adicionar legendas, encontro um erro. Estranhamente, eles funcionam perfeitamente bem fora deste ambiente. Aqui está um exemplo de um dos gráficos:
\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}
Como mencionei, sou novo no LaTeX, então posso não estar usando as soluções mais elegantes aqui. Estou empregando vários pacotes para adequar o texto ao formato universitário. Peço desculpas se parece um pouco confuso.
Responder1
Por favor, vejaAcabei de ser solicitado a escrever um exemplo prático mínimo (MWE), o que é isso?para saber como escrever um MWE.
Quando você escreve legend style={font=\tin},
, você provavelmente quis dizer:
legend style={font=\tiny},