问题:
实际上,我正在处理一个例子,其中数字拖到问题文本上方,我无法理解,这是什么问题。有什么帮助吗?
梅威瑟:
\documentclass[12pt, a4paper]{article}
\usepackage[
top=0.6in,bottom=0.5in,left=0.7in,right=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{subcaption}
\usepackage[parfill]{parskip}
%line spacing
\renewcommand{\baselinestretch}{1.0}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{intersections}
\makeatother
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
\lhead{}
\rhead{}
\chead{}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\lfoot{}
\cfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\headsep=10pt
\begin{document}
\textbf{Example~1}
This is the body text of my example 1...........
\begin{figure}
\centering
\begin{subfigure}{6cm}
\centering
\begin{tikzpicture}
\tkzDefPoint(-5,0){B}
\tkzDefPoint(0,0){C}
\tkzDefPoint(-1,5){A}
\tkzDrawSegments(A,B B,C C,A)
\tkzLabelPoints[left,xshift=00pt](B)
\tkzLabelPoints[right,xshift=00pt](C)
\tkzLabelPoints[above](A)
\tkzDefShiftPoint[A](-3,-2){A1}
\tkzDefShiftPoint[A](2,-2){A2}
\tkzDrawVector[thick,<->](A1,A2)
\tkzDefPoint(-2.5,3.1){D}
\tkzLabelPoints[left,yshift=2mm](D)
\tkzDefPoint(-0.65,3.1){E}
\tkzLabelPoints[right,yshift=2mm](E)
\end{tikzpicture}
\caption*{(i)}
\end{subfigure}
\hspace{1cm}
\begin{subfigure}{6cm}
\centering
\begin{tikzpicture}
\tkzDefPoint(2,2){B}
\tkzDefPoint(8,0){C}
\tkzDefPoint(7,5){A}
\tkzDrawSegments(A,B B,C C,A)
\tkzLabelPoints[left,xshift=00pt](B)
\tkzLabelPoints[right,xshift=00pt](C)
\tkzLabelPoints[above](A)
\tkzDefShiftPoint[A](-3,-0.8){A1}
\tkzDefShiftPoint[A](2,-2.5){A2}
\tkzDrawVector[thick,<->](A1,A2)
\tkzDefPoint(5.1,3.85){D}
\tkzLabelPoints[above,yshift=0mm](D)
\tkzDefPoint(7.3,3.3){E}
\tkzLabelPoints[right,yshift=0mm](E)
\end{tikzpicture}
\caption*{(ii)}
\end{subfigure}
\end{figure}
\end{document}
答案1
添加浮动期权您的figure
环境
\documentclass[12pt, a4paper]{article}
\usepackage[
top=0.6in,bottom=0.5in,left=0.7in,right=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{subcaption}
\usepackage[parfill]{parskip}
%line spacing
\renewcommand{\baselinestretch}{1.0}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{intersections}
\makeatother
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
\lhead{}
\rhead{}
\chead{}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\lfoot{}
\cfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\headsep=10pt
\begin{document}
\textbf{Example~1}
This is the body text of my example 1...........
\begin{figure}[h]
\centering
\begin{subfigure}{6cm}
\centering
\begin{tikzpicture}
\tkzDefPoint(-5,0){B}
\tkzDefPoint(0,0){C}
\tkzDefPoint(-1,5){A}
\tkzDrawSegments(A,B B,C C,A)
\tkzLabelPoints[left,xshift=00pt](B)
\tkzLabelPoints[right,xshift=00pt](C)
\tkzLabelPoints[above](A)
\tkzDefShiftPoint[A](-3,-2){A1}
\tkzDefShiftPoint[A](2,-2){A2}
\tkzDrawVector[thick,<->](A1,A2)
\tkzDefPoint(-2.5,3.1){D}
\tkzLabelPoints[left,yshift=2mm](D)
\tkzDefPoint(-0.65,3.1){E}
\tkzLabelPoints[right,yshift=2mm](E)
\end{tikzpicture}
\caption*{(i)}
\end{subfigure}
\hspace{1cm}
\begin{subfigure}{6cm}
\centering
\begin{tikzpicture}
\tkzDefPoint(2,2){B}
\tkzDefPoint(8,0){C}
\tkzDefPoint(7,5){A}
\tkzDrawSegments(A,B B,C C,A)
\tkzLabelPoints[left,xshift=00pt](B)
\tkzLabelPoints[right,xshift=00pt](C)
\tkzLabelPoints[above](A)
\tkzDefShiftPoint[A](-3,-0.8){A1}
\tkzDefShiftPoint[A](2,-2.5){A2}
\tkzDrawVector[thick,<->](A1,A2)
\tkzDefPoint(5.1,3.85){D}
\tkzLabelPoints[above,yshift=0mm](D)
\tkzDefPoint(7.3,3.3){E}
\tkzLabelPoints[right,yshift=0mm](E)
\end{tikzpicture}
\caption*{(ii)}
\end{subfigure}
\end{figure}
\end{document}