Inserting image in example
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
Here is my tex-code:
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
endExample
beginfigure[ht!]
centering
includegraphics[width=4cm]billede.png
labelfig:boat1
endfigure
enddocument
I would like my image to be inside the example-box but latex keeps showing an error. How do I fix this?
Thanks.
graphics
New contributor
add a comment |Â
up vote
2
down vote
favorite
Here is my tex-code:
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
endExample
beginfigure[ht!]
centering
includegraphics[width=4cm]billede.png
labelfig:boat1
endfigure
enddocument
I would like my image to be inside the example-box but latex keeps showing an error. How do I fix this?
Thanks.
graphics
New contributor
Welcome to TeX.Stackexchange!
â samcarter
2 hours ago
1
Unrelated to your problem, butlabelfig:boat1
won't work because the figure does not have a caption.
â samcarter
2 hours ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Here is my tex-code:
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
endExample
beginfigure[ht!]
centering
includegraphics[width=4cm]billede.png
labelfig:boat1
endfigure
enddocument
I would like my image to be inside the example-box but latex keeps showing an error. How do I fix this?
Thanks.
graphics
New contributor
Here is my tex-code:
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
endExample
beginfigure[ht!]
centering
includegraphics[width=4cm]billede.png
labelfig:boat1
endfigure
enddocument
I would like my image to be inside the example-box but latex keeps showing an error. How do I fix this?
Thanks.
graphics
graphics
New contributor
New contributor
edited 2 hours ago
Bobyandbob
3,86851263
3,86851263
New contributor
asked 2 hours ago
saleem
111
111
New contributor
New contributor
Welcome to TeX.Stackexchange!
â samcarter
2 hours ago
1
Unrelated to your problem, butlabelfig:boat1
won't work because the figure does not have a caption.
â samcarter
2 hours ago
add a comment |Â
Welcome to TeX.Stackexchange!
â samcarter
2 hours ago
1
Unrelated to your problem, butlabelfig:boat1
won't work because the figure does not have a caption.
â samcarter
2 hours ago
Welcome to TeX.Stackexchange!
â samcarter
2 hours ago
Welcome to TeX.Stackexchange!
â samcarter
2 hours ago
1
1
Unrelated to your problem, but
labelfig:boat1
won't work because the figure does not have a caption.â samcarter
2 hours ago
Unrelated to your problem, but
labelfig:boat1
won't work because the figure does not have a caption.â samcarter
2 hours ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
If you want your image inside the example box, you should not use a figure
environment, because a figure environment allows your image to "float" through your document, which is contra productive if you want it at a specific place.
In case you might want a caption for your image, you could use the captionof
macro from the caption
package.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
centering
includegraphics[width=4cm]example-image
endExample
enddocument
Thanks. It worked.
â saleem
26 mins ago
add a comment |Â
up vote
2
down vote
Welcome in TeX.SE.
The error comes from the float environment figure
. Floats may not to be inside any fixed environment as example
in your example. You can simply remove the figure environment and add:
begincenter
includegraphics[width=4cm]billede.png
endcenter
at the end of your example environment.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
begincenter
includegraphics[width=4cm]billede.png
endcenter
endExample
enddocument
afigure
is float environment as well atable
is. both should not be included in any box...
â Zarko
2 hours ago
@Zarko yes, you are right. My answer mentions otherwise ? I can edit to avoid misunderstanding.
â Piroooh
2 hours ago
i took liberty and extend your explanation in you answer with my comment (instead of you).
â Zarko
24 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
If you want your image inside the example box, you should not use a figure
environment, because a figure environment allows your image to "float" through your document, which is contra productive if you want it at a specific place.
In case you might want a caption for your image, you could use the captionof
macro from the caption
package.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
centering
includegraphics[width=4cm]example-image
endExample
enddocument
Thanks. It worked.
â saleem
26 mins ago
add a comment |Â
up vote
3
down vote
If you want your image inside the example box, you should not use a figure
environment, because a figure environment allows your image to "float" through your document, which is contra productive if you want it at a specific place.
In case you might want a caption for your image, you could use the captionof
macro from the caption
package.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
centering
includegraphics[width=4cm]example-image
endExample
enddocument
Thanks. It worked.
â saleem
26 mins ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
If you want your image inside the example box, you should not use a figure
environment, because a figure environment allows your image to "float" through your document, which is contra productive if you want it at a specific place.
In case you might want a caption for your image, you could use the captionof
macro from the caption
package.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
centering
includegraphics[width=4cm]example-image
endExample
enddocument
If you want your image inside the example box, you should not use a figure
environment, because a figure environment allows your image to "float" through your document, which is contra productive if you want it at a specific place.
In case you might want a caption for your image, you could use the captionof
macro from the caption
package.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
centering
includegraphics[width=4cm]example-image
endExample
enddocument
answered 2 hours ago
samcarter
79.7k787253
79.7k787253
Thanks. It worked.
â saleem
26 mins ago
add a comment |Â
Thanks. It worked.
â saleem
26 mins ago
Thanks. It worked.
â saleem
26 mins ago
Thanks. It worked.
â saleem
26 mins ago
add a comment |Â
up vote
2
down vote
Welcome in TeX.SE.
The error comes from the float environment figure
. Floats may not to be inside any fixed environment as example
in your example. You can simply remove the figure environment and add:
begincenter
includegraphics[width=4cm]billede.png
endcenter
at the end of your example environment.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
begincenter
includegraphics[width=4cm]billede.png
endcenter
endExample
enddocument
afigure
is float environment as well atable
is. both should not be included in any box...
â Zarko
2 hours ago
@Zarko yes, you are right. My answer mentions otherwise ? I can edit to avoid misunderstanding.
â Piroooh
2 hours ago
i took liberty and extend your explanation in you answer with my comment (instead of you).
â Zarko
24 mins ago
add a comment |Â
up vote
2
down vote
Welcome in TeX.SE.
The error comes from the float environment figure
. Floats may not to be inside any fixed environment as example
in your example. You can simply remove the figure environment and add:
begincenter
includegraphics[width=4cm]billede.png
endcenter
at the end of your example environment.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
begincenter
includegraphics[width=4cm]billede.png
endcenter
endExample
enddocument
afigure
is float environment as well atable
is. both should not be included in any box...
â Zarko
2 hours ago
@Zarko yes, you are right. My answer mentions otherwise ? I can edit to avoid misunderstanding.
â Piroooh
2 hours ago
i took liberty and extend your explanation in you answer with my comment (instead of you).
â Zarko
24 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Welcome in TeX.SE.
The error comes from the float environment figure
. Floats may not to be inside any fixed environment as example
in your example. You can simply remove the figure environment and add:
begincenter
includegraphics[width=4cm]billede.png
endcenter
at the end of your example environment.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
begincenter
includegraphics[width=4cm]billede.png
endcenter
endExample
enddocument
Welcome in TeX.SE.
The error comes from the float environment figure
. Floats may not to be inside any fixed environment as example
in your example. You can simply remove the figure environment and add:
begincenter
includegraphics[width=4cm]billede.png
endcenter
at the end of your example environment.
documentclass[12pt]article
usepackagetikz
usepackageamsmath
usetikzlibraryarrows
usepackagexcolor
usepackagesectsty
usepackageamsfonts
usepackage[utf8]inputenc
usepackage[yyyymmdd]datetime
usepackage[margin=1in]geometry
usepackagegraphicx
usepackagecleveref
usepackage[most]tcolorbox
newtcbtheoremTheoremTheorem
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!75!black,
fonttitle=bfseries,
boxed title style=
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
thm
newtcbtheorem[no counter]ExampleEksempel
enhanced,
sharp corners,
attach boxed title to top left=
yshifttext=-1mm
,
colback=white,
colframe=blue!25,
fonttitle=bfseries,
coltitle=black,
boxed title style=
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
prf
begindocument
section*Funktioner
subsection*Hvad er en graf?
noindent En textbfgraf er billedet af en funktion, som man tegner ind i et koordinatsystem. \
beginExample
noindent Vi ønsker, at tegne grafen for funktionen $y=4cdot x$. Denne funktion beskriver sammenhængen mellem $x$ og $y$. Vi vælger først forskellige $x$-værdier og finder deres $y$-værdier: \
begincenter
begintabular hline
$x$ & $y$ \ hline
0 & 0 \
1 & 4 \
2 & 8 \
3 & 12 \
4 & 16 \ hline
endtabular
endcenter
noindent Ved at bruge $x$ og $y$-værdierne kan vi nu tegne grafen (billedet) af funktionen $y=4cdot x$:
begincenter
includegraphics[width=4cm]billede.png
endcenter
endExample
enddocument
edited 24 secs ago
samcarter
79.7k787253
79.7k787253
answered 2 hours ago
Piroooh
858
858
afigure
is float environment as well atable
is. both should not be included in any box...
â Zarko
2 hours ago
@Zarko yes, you are right. My answer mentions otherwise ? I can edit to avoid misunderstanding.
â Piroooh
2 hours ago
i took liberty and extend your explanation in you answer with my comment (instead of you).
â Zarko
24 mins ago
add a comment |Â
afigure
is float environment as well atable
is. both should not be included in any box...
â Zarko
2 hours ago
@Zarko yes, you are right. My answer mentions otherwise ? I can edit to avoid misunderstanding.
â Piroooh
2 hours ago
i took liberty and extend your explanation in you answer with my comment (instead of you).
â Zarko
24 mins ago
a
figure
is float environment as well a table
is. both should not be included in any box...â Zarko
2 hours ago
a
figure
is float environment as well a table
is. both should not be included in any box...â Zarko
2 hours ago
@Zarko yes, you are right. My answer mentions otherwise ? I can edit to avoid misunderstanding.
â Piroooh
2 hours ago
@Zarko yes, you are right. My answer mentions otherwise ? I can edit to avoid misunderstanding.
â Piroooh
2 hours ago
i took liberty and extend your explanation in you answer with my comment (instead of you).
â Zarko
24 mins ago
i took liberty and extend your explanation in you answer with my comment (instead of you).
â Zarko
24 mins ago
add a comment |Â
saleem is a new contributor. Be nice, and check out our Code of Conduct.
saleem is a new contributor. Be nice, and check out our Code of Conduct.
saleem is a new contributor. Be nice, and check out our Code of Conduct.
saleem is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457989%2finserting-image-in-example%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Welcome to TeX.Stackexchange!
â samcarter
2 hours ago
1
Unrelated to your problem, but
labelfig:boat1
won't work because the figure does not have a caption.â samcarter
2 hours ago