2

I want to do something like this:

\begin{figure}[H]
\centering{
\begin{overpic}[scale=0.3,grid,tics=5]{???}\label{???}
\tiny{
\put(80,55){\begin{table}
              \centering
              \begin{tabular}{|r|c|}
                \hline
                X & X \\
                X & X \\
                X & X \\
                X & X \\
                \hline
              \end{tabular}
              %\caption{}\label{}
            \end{table}}
}
\end{overpic}
\caption[???]{??}}
\end{figure}

But when I want to compile it, LaTeX show me

1.247    \end{table}}
?

It is impossible to do that?

  • When you ask a question, you will get a much higher chance of someone giving you an answer if you provide a directly compilable document, beginning with \documentclass and finishing by \end{document}, that reproduces your problem or shows what you would like to do, and containing only relevant code (For example, here, no need for [scale=0.3,grid,tics=5]), called a MWE (Minimum Working Example). More informations here meta.tex.stackexchange.com/questions/228/… – HcN Dec 7 '15 at 2:13
2

The \put command cannot accept floats as arguments, but you can insert pretty much anything else in it. Here it works if you remove the \begin{table}. You cannot include \caption if not a float, so if you do not want any, this will do. Otherwise, there surely is some way to add a caption somehow (\put can perfectly handle text), but in this case I would advise you ask another question (With a MWE).

Here is a working example:

\documentclass{report}
\usepackage{overpic}

\begin{document}

\begin{figure}
\centering\tiny
\begin{overpic}{example-image-a}

\put(80,55){\begin{tabular}{|r|c|}
                \hline
                X & X \\
                X & X \\
                X & X \\
                X & X \\
                \hline
              \end{tabular}}

\end{overpic}
\caption{??}
% {???}\label{???}
\end{figure}


\end{document}

A couple of other things:

  • \centering and \tiny are not command (e.g. do not work like \tiny{Some text}) but switches. There are used directly this way : \centering and will affect all the current environment. In a figure or table float, just use \centering once at the beginning and nothing else. If you want to restrict their effect, use curly brackets like {\tiny Some text.}
  • In a float, always place \label after \caption, otherwise it will not work.
  • If you need figures for MWEs, use example-image-a, example-image-b etc. like in the example.
  • \centering and \tiny are commands however with unrestricted settings until delimited ;-) – user31729 Dec 22 '15 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.