1

I am working on my thesis project and want to insert an image. This works fine at first, but I want to use the figure environment to give it a caption. However, when I do this I get ``` signs on the page instead of the figure. Everything else works just fine.

What am I doing wrong? Does it got something to do with a float and a report decument?

This is my preamble:

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {C:/Users/beren/Documents/Master SCM/Thesis/Images/} }
\usepackage[a4paper, width=150mm, top = 16mm, bindingoffset=10mm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{15pt}
\fancyhead[LE,RO]{Topic title}
\fancyfoot{}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LO,CE]{SCM Master Thesis} 
\fancyfoot[CO,RE]{Name}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=apa, backend=biber]{biblatex}
\addbibresource{References.bib}
%\renewcommand*{\nameyeardelim}{\addcomma\space}
\usepackage[nottoc,numbib]{tocbibind}

\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\bfseries}{}{0pt}{\Huge}

And this is what my code of my chapter looks like (where I want to insert the picture), so no not in the main.tex file:

\begin{figure}[!h]
    \centering
\tikzstyle{myblock} = [rectangle, draw, minimum height=1cm] 
\begin{tikzpicture}
    \node (BDA)[myblock]{BDA Capabilities};
    \node (FP)[myblock,right = 0.2cm and 8cm of BDA]{Firm Performance};
    \draw[->] (BDA) -- node[above, yshift = 0.2cm] {+} (FP);
\end{tikzpicture}
    \caption{Conceptual model}
    \label{fig:my_label}
\end{figure}

\begin{figure}[t]
\caption{Simplified model of container flow with three possible decisions at the port to continue}
%\centering
\includegraphics[width=0.7\textwidth]{Figure1} 
\end{figure}

I actually gave it a second attempt to get one of my own figures in Latex as well, but I got the same issue.

Your response is highly appreciated! :-)

Link to figure: https://imgur.com/a/yzr9GdC Minimum code:

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {C:/Users/beren/Documents/Master SCM/Thesis/Images/} }
\usepackage{tikz}
\usetikzlibrary{positioning}





\begin{document}

\begin{figure}[!h]
    \centering
\tikzstyle{myblock} = [rectangle, draw, minimum height=1cm] 
\begin{tikzpicture}
    \node (BDA)[myblock]{BDA Capabilities};
    \node (FP)[myblock,above right = 0.2cm and 8cm of BDA]{Firm Performance};
    \draw[->] (BDA) -- node[above, yshift = 0.2cm] {+} (FP);
\end{tikzpicture}
    \caption{Conceptual model}
    \label{fig:my_label}
\end{figure}

\begin{figure}[t]
\caption{Simplified model of container flow with three possible decisions at the port to continue}
%\centering
\includegraphics[width=0.7\textwidth]{Figure1} 
\end{figure}

\end{document}

10
  • 4
    Welcome! right = 0.2cm and 8cm of BDA is not correct, do you mean above right = 0.2cm and 8cm of BDA? Also, your preamble does not seem to load tikz, nor positioning, which would be needed here. BTW, \tikzstyle is deprecated.
    – user194703
    Mar 1, 2020 at 19:59
  • 3
    Please merge your code fragments to one complete small document with your image which we can compile as it is.
    – Zarko
    Mar 1, 2020 at 20:02
  • Thank you, I tried it but unfortunately it did not work. You are right, I forgot to mention the preamble code for tikz but in fact I had it in my Latex document. @Zarko, I put the minimum working code in my question, is that what you are looking for?
    – Fastbanana
    Mar 1, 2020 at 21:01
  • Just to clarify: Is the figure that does not show up the tikzpictureor the one added via \includegraphcis?
    – leandriis
    Mar 1, 2020 at 21:10
  • 2
    Probably the space in your \graphicspath is the problem?
    – leandriis
    Mar 1, 2020 at 21:44

2 Answers 2

1

I'm sorry, but I didn't quite understand your request. Are you asking for something like this?

enter image description here

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[!h]
\centering
\tikzset{every picture/.style={line width=0.75pt}}      
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]    (411.53,118) -- (456,90.5) ;
\draw  [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]  (87,130.97) .. controls (87,123.81) and (92.81,118) .. (99.97,118) -- (229.53,118) .. controls (236.69,118) and (242.5,123.81) .. (242.5,130.97) -- (242.5,169.89) .. controls (242.5,177.05) and (236.69,182.86) .. (229.53,182.86) -- (99.97,182.86) .. controls (92.81,182.86) and (87,177.05) .. (87,169.89) -- cycle ;
\draw  [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]  (269,130.97) .. controls (269,123.81) and (274.81,118) .. (281.97,118) -- (411.53,118) .. controls (418.69,118) and (424.5,123.81) .. (424.5,130.97) -- (424.5,169.89) .. controls (424.5,177.05) and (418.69,182.86) .. (411.53,182.86) -- (281.97,182.86) .. controls (274.81,182.86) and (269,177.05) .. (269,169.89) -- cycle ;
\draw  [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]  (452,40.97) .. controls (452,33.81) and (457.81,28) .. (464.97,28) -- (594.53,28) .. controls (601.69,28) and (607.5,33.81) .. (607.5,40.97) -- (607.5,79.89) .. controls (607.5,87.05) and (601.69,92.86) .. (594.53,92.86) -- (464.97,92.86) .. controls (457.81,92.86) and (452,87.05) .. (452,79.89) -- cycle ;
\draw  [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]  (452,130.97) .. controls (452,123.81) and (457.81,118) .. (464.97,118) -- (594.53,118) .. controls (601.69,118) and (607.5,123.81) .. (607.5,130.97) -- (607.5,169.89) .. controls (607.5,177.05) and (601.69,182.86) .. (594.53,182.86) -- (464.97,182.86) .. controls (457.81,182.86) and (452,177.05) .. (452,169.89) -- cycle ;
\draw  [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]  (452,219.97) .. controls (452,212.81) and (457.81,207) .. (464.97,207) -- (594.53,207) .. controls (601.69,207) and (607.5,212.81) .. (607.5,219.97) -- (607.5,258.89) .. controls (607.5,266.05) and (601.69,271.86) .. (594.53,271.86) -- (464.97,271.86) .. controls (457.81,271.86) and (452,266.05) .. (452,258.89) -- cycle ;
\draw [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]    (242,151) -- (268,151.5) ;
\draw [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]    (425,151) -- (453,151.5) ;
\draw [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]    (457,209.5) -- (411.53,182.86) ;
\draw [color={rgb, 255:red, 74; green, 144; blue, 226 }  ,draw opacity=1 ][line width=2.25]    (89,303) -- (605,299.53) ;
\draw [shift={(610,299.5)}, rotate = 539.62] [fill={rgb, 255:red, 74; green, 144; blue, 226 }  ,fill opacity=1 ][line width=0.08]  [draw opacity=0] (14.29,-6.86) -- (0,0) -- (14.29,6.86) -- cycle    ;
\draw (164.75,150.43) node   [align=left] {BDA Capabilities};
% Text Node
\draw (346.75,150.43) node   [align=left] {Firm Performance};
% Text Node
\draw (486,59) node   [align=left] {text 1};
% Text Node
\draw (486,148) node   [align=left] {text 2};
% Text Node
\draw (488,238) node   [align=left] {text 3};
\end{tikzpicture}
\caption{Conceptual model}
    \label{fig:my_label}
\end{figure}

\end{document}
2
  • 1
    Wow, you put a lot of effort in this. Thank you! My issue was that the figure(s) did not show up, but adding /newpage solved the issue. I will take your input into account for my thesis, probably very useful at some point in time. :-)
    – Fastbanana
    Mar 2, 2020 at 21:59
  • @Fastbanana Actually I have used Mathcha.io a very fast editor to draw in TikZ. :-) You, however, always follow the advice of the best users who follow the correct rules of the code to be used in TikZ.
    – Sebastiano
    Mar 2, 2020 at 22:01
0

It is not clear, what is your problem, especially because You stated in your comment, that it is solved by inserting /newpage in your code (where?) ...

Let me emphasized, that for helping you it is crucial, that you provide MWE (Minimal Working Example), which reproduce your problem. In the most of times happens, that in it preparation you discover error yourself. It is also important for other members of site, that they can compare own similar problems and see if proposed solutions also works for them.

Assuming, that \graphicspath is correctly defined and that it lead to folder, where is image stored and that image is in it, than the next suggestion can be possible solution.

Suggestion also contain off-topic proposal how to simply draw your TikZ picture with help of the forest package:

\documentclass{article}
\usepackage{graphicx}
\usepackage{forest}
\usetikzlibrary{arrows.meta,
                positioning}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{figure}[ht]
    \centering
    \begin{forest}
for tree = {
% nodes style
          draw = cyan, rounded corners, ultra thick,
minimum height = 1cm,
    text width = 32mm, align=left,
% tree style
        grow' = 0,
 child anchor = west,
         edge = {thick, cyan},
        s sep = 3mm,
        l sep = 6mm,
            }
[BDA Capabilities, name=root
    [Firm Performance
        [text 1]
        [text 2]
        [text 3, name=leaf3]
    ]
]
\coordinate[below=3mm of leaf3.south east] (aux);
\path[draw=cyan, ultra thick,-{Triangle[length=2mm]}]
    (root.west |- aux)  -- (aux);
\end{forest}
    \caption{Conceptual model.}
\label{fig:concept}

\medskip
\includegraphics[width=0.7\linewidth]{example-image-duck}
    \caption{Simplified model of container flow with three possible decisions at the port to continue.}
\label{fig:container}
    \end{figure}
I suppose that figures \ref{fig:concept} and \ref{fig:container} should be one after other closely tied, so I put them in a common float \verb+figure+ with two captions.
\end{document}

enter image description here

Red lines in above image indicate border of text area. It helps to see, that on page is sufficient space for both figures (in common float).

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.