0

I am relatively new to LaTeX, but I have been attempting to write my Master's thesis using it. I have been creating several plots using the pgfplots package. However, when I attempt to insert these graphs into the figure environment to reference them and add captions, I encounter an error. Strangely, they work perfectly fine outside this environment. Here's an example of one of the plots:

\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}

As I mentioned, I'm new to LaTeX, so I may not be using the most elegant solutions here. I'm employing various packages to conform the text to the college format. I apologize if it appears somewhat messy.

bonk
  • 885
artfer81
  • 1
  • 1
  • Welcome to tex.sx. – barbara beeton Feb 03 '24 at 16:57
  • Welcome to TeX SE. There's no way for us to compile your code as-is because we don't have access to your repUERJ document class and packages. You also didn't include your error message, so it's hard to tell exactly what is going wrong with your code. – bonk Feb 03 '24 at 16:59

1 Answers1

1

Please see I've just been asked to write a minimal working example (MWE), what is that? for how to write a MWE.

When you write legend style={font=\tin},, you probably meant:

legend style={font=\tiny},