附录标题不是出现在开头,而是首先显示内容。第一个附录只有文本,附录显示在顶部,然后是文本,但是,对于附录中有图像的情况,首先显示图像,然后显示附录的标题。我希望附录标题出现在最前面。
并且 MWE 是:
\documentclass[12pt, a4paper]{article}
\title{\textbf{Laser Pointer Based Human-Computer-Interaction using Computer-Vision}}
\usepackage{wrapfig}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{acronym}
\usepackage[acronym]{glossaries}
\usepackage[utf8x]{inputenc}
\usepackage{caption}
\DeclareCaptionFont{mysize}{\fontsize{8}{9.6}\selectfont}
\captionsetup{font=mysize}
\usepackage[titletoc,title]{appendix}
\apptocmd{\appendices}{\let\LaTeXStandardTheSection\thesection
\apptocmd{\figure}{\let\thesection\LaTeXStandardTheSection}{}{}
\apptocmd{\thesection}{:}{}{}}{}{}
\begin{document}
\begin{appendices}
\section{Raspberry Pi and Camera Board}
Raspberry Pi is a single-board computer with processor
\section{Projected Screen After Exposure Correction}
\begin{figure}[htp]
\includegraphics[scale=0.30]{projectorwithout.png}
\caption{Projected Screen After Exposure Correction}
\label{}
\end{figure}
\end{appendices}
\end{document}
答案1
我更喜欢定义一个基本兼容的环境,以便figure
能够提供标题和标签,从而能够引用附录中的图片。
\documentclass[12pt, a4paper]{article}
\title{\textbf{Laser Pointer Based Human-Computer-Interaction using Computer-Vision}}
\usepackage{wrapfig}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{acronym}
\usepackage[acronym]{glossaries}
\usepackage[utf8x]{inputenc}
\usepackage{caption}
\DeclareCaptionFont{mysize}{\fontsize{8}{9.6}\selectfont}
\captionsetup{font=mysize}
\usepackage[titletoc,title]{appendix}
\apptocmd{\appendices}{\let\LaTeXStandardTheSection\thesection
\apptocmd{\figure}{\let\thesection\LaTeXStandardTheSection}{}{}
\apptocmd{\thesection}{:}{}{}}{}{}
\usepackage{xparse}
\makeatletter
\DeclareDocumentEnvironment{appendixfig}{}{
\par\medskip\noindent
\begin{minipage}{\linewidth}
\def\@captype{figure}
\centering
}
{
\end{minipage}
\par\bigskip
}
\makeatother
\begin{document}
\begin{appendices}
\section{Raspberry Pi and Camera Board}
Raspberry Pi is a single-board computer with processor
\section{Projected Screen After Exposure Correction}
\begin{appendixfig}
\includegraphics[width=.6\linewidth]{example-image}
\caption{Projected Screen After Exposure Correction}
\label{}
\end{appendixfig}
\end{appendices}
\end{document}
您的代码中有一些奇怪之处;您加载了两次包,您真的需要使用吗utf8x
?它可以在您不期望的时候做一些疯狂的事情。
答案2
这是一个解决方案,以及对序言的一些小改进:
\documentclass[12pt, a4paper]{article}
\title{\textbf{Laser Pointer Based Human-Computer-Interaction using Computer-Vision}}
%\usepackage{graphicx}
\usepackage{times}
\usepackage[top=3.5cm, bottom=2cm, left=3.5cm, right=2cm]{geometry}
\usepackage{sectsty}
\sectionfont{\fontsize{14}{12}\selectfont}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{listings}
\usepackage{mathtools}
\usepackage{pgfgantt}
\usepackage{tocloft}
\usepackage{tocbibind}
\usepackage{indentfirst}
\usepackage{mathtools}
\usepackage{acronym}
\usepackage[acronym]{glossaries}
\usepackage[utf8x]{inputenc}
\usepackage{caption}
\DeclareCaptionFont{mysize}{\fontsize{8}{9.6}\selectfont}
\captionsetup{font=mysize}
\usepackage{chngcntr}
\usepackage[titletoc,title]{appendix}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\counterwithin{table}{section}
\counterwithin{figure}{section}
\counterwithin{equation}{section}
\renewcommand{\cftfigfont}{\text{Figure} }
\renewcommand{\cfttabfont}{\text{Table} }
\renewcommand{\appendixname}{APPENDIX}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\listtablename}{LIST OF TABLES}
\renewcommand\cftsecleader{\cftdotfill{\cftdotsep}}
\usepackage{etoolbox}
\usepackage{hyperref}
\apptocmd{\appendices}{\let\LaTeXStandardTheSection\thesection
\apptocmd{\figure}{\let\thesection\LaTeXStandardTheSection}{}{}
\apptocmd{\thesection}{:}{}{}}{}{}
\hypersetup{
hidelinks = true
}
\apptocmd{\appendices}{\let\LaTeXStandardTheSection\thesection
\apptocmd{\figure}{\let\thesection\LaTeXStandardTheSection}{}{}
\apptocmd{\thesection}{:}{}{}}{}{}
\begin{document}
\begin{appendices}
\section{Raspberry Pi and Camera Board}
Raspberry Pi is a single-board computer with processor
\section{Projected Screen After Exposure Correction}
\begin{center}
\label{}
\includegraphics[scale=0.30]{projectorwithout.png}
{Projected Screen After Exposure Correction}
\end{center}
\end{appendices}
\end{document}
有时float
s 不是那么直观地处理,有时最好避免它们。这是其中一种情况,\includegraphics
单独放置图像总是在它被写入的位置。