我无法让图像精确地显示在文本下方。我已将其定义为位于文本下方和括号内,但似乎不起作用。我附上了一张我得到的输出图片(我使用的是下载的模板)。
\documentclass[a4 paper]{article}
\usepackage[inner=1.5cm,outer=1.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx}
\graphicspath{{/Desktop/securityAnalytics/KevinBHMW01/}}
\usepackage{setspace}
\usepackage[rgb]{xcolor}
\usepackage{verbatim}
\usepackage{amsgen,amsmath,amstext,amsbsy,amsopn,tikz,amssymb,tkz-linknodes}
\usepackage{fancyhdr}
\usepackage[colorlinks=true, urlcolor=blue, linkcolor=blue, citecolor=blue]
{hyperref}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{rotating}
\usepackage[english]{babel}
\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\newcommand{\homework}[6]{
\pagestyle{myheadings}
\thispagestyle{plain}
\newpage
\setcounter{page}{1}
\noindent
\begin{center}
\framebox{
\vbox{\vspace{2mm}
\hbox to 6.28in { {\bf EE5453: Security Analytics \hfill} }
\vspace{6mm}
\hbox to 6.28in { {\Large \hfill #1 (#2) \hfill} }
\vspace{6mm}
\hbox to 6.28in { {\it Instructor: #3 \hfill Student: #5} }
\vspace{2mm}}}
\end{center}
\markboth{#5 -- #1}{#5 -- #1}
\vspace*{4mm}}
\begin{document}
\homework{Assignment \#1}{February 13 2019 }{Wonjun Lee, PhD}{}{Kevin
Brinneman}{}
{\begin{tikzpicture}[outline/.style={draw=#1,thick,fill=#1!5}]
\node [outline=yellow] at (0,1) {\bf Dataset and tensors at pixel level:};
\end{tikzpicture}}
{MNIST data-set is widely used for classification and image recognition, this is considered a simple task and involves minimum programming skills but it is important because is often used as a benchmark to test how accurate our deep learning models are. The data set has been split in two sections: Training and testing. The data consists of 60,000 images of handwritten digits from different subjects and the testing data set consists of 10,000 images for our model.Per image in the data-set, has a size of 28x28; each element of the 28 by 28 matrix represents one pixel and each pixel consists of a 0-D tensor, it can range from 0 up to 255; where 0 is taken to be black color and 255 white, anything in between is gray scale.}
\begin{figure}
\centering
\includegraphics[scale=.5]{5}[thbp]
\caption{Handwritten number 5 from dataset.}
\label{fig1}
\end{figure}
\end{document}
答案1
您显示的代码存在一些问题,我在以下 MWE 中进行了更正。
这是最重要的问题:
- 要获得 DiN A4 纸,您必须使用类选项(和
a4paper
之间没有空格)。a4
paper
hyperref
在您的情况下,应该最后调用包。- 你不需要
{...}
围绕你的环境来写作tikzpicture
。 - 文本也一样
MNIST ... scale.
[thbp]
是环境的一个选择figure
,不是\includegraphics
- 因为我没有您的图像,所以
5
我使用了example-image
MWE 包中的图像。
导致图像位置错误的主要错误是选项位置错误[thbp]
。
使用以下代码
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[inner=1.5cm,outer=1.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage[rgb]{xcolor}
\usepackage{verbatim}
\usepackage{amsgen,amsmath,amstext,amsbsy,amsopn,amssymb}
\usepackage{tikz,tkz-linknodes}
\usepackage{fancyhdr}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage[%
colorlinks=true,
urlcolor=blue,
linkcolor=blue,
citecolor=blue
]{hyperref} % <=========================================================
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\newcommand{\homework}[6]{%
\pagestyle{myheadings}
\thispagestyle{plain}
\newpage
\setcounter{page}{1}
\noindent
\begin{center}
\framebox{%
\vbox{\vspace{2mm}
\hbox to 6.28in { {\bf EE5453: Security Analytics \hfill} }
\vspace{6mm}
\hbox to 6.28in { {\Large \hfill #1 (#2) \hfill} }
\vspace{6mm}
\hbox to 6.28in { {\it Instructor: #3 \hfill Student: #5} }
\vspace{2mm}}%
}
\end{center}
\markboth{#5 -- #1}{#5 -- #1}
\vspace*{4mm}%
}
\begin{document}
\homework
{Assignment \#1}% 1
{February 13 2019 }% 2
{Wonjun Lee, PhD}% 3
{}% 4
{Kevin Brinneman}% 5
{}% 6
\begin{tikzpicture}[outline/.style={draw=#1,thick,fill=#1!5}]
\node [outline=yellow] at (0,1) {\bf Dataset and tensors at pixel level:};
\end{tikzpicture}
MNIST data-set is widely used for classification and image recognition,
this is considered a simple task and involves minimum programming skills
but it is important because is often used as a benchmark to test how
accurate our deep learning models are. The data set has been split in
two sections: Training and testing. The data consists of 60,000 images
of handwritten digits from different subjects and the testing data set
consists of 10,000 images for our model. Per image in the data-set, has
a size of 28x28; each element of the 28 by 28 matrix represents one pixel
and each pixel consists of a 0-D tensor, it can range from 0 up to 255;
where 0 is taken to be black color and 255 white, anything in between
is gray scale.
\begin{figure}[thbp] % <================================================
\centering
\includegraphics[scale=.5]{example-image}
\caption{Handwritten number 5 from dataset.}
\label{fig1}
\end{figure}
\end{document}
我得到的结果: