包 {Rotating} 内容混乱

包 {Rotating} 内容混乱

我发现在使用 {rotating} 包和 \begin{sidewaysfigure} 后很难组织内容。图像跳转到下一节,而表格显示在图像之前。我应该怎么做才能控制内容的顺序。我试过将宽度调整为 0.5\textwidth。但不起作用。这是最小的工作代码示例

\documentclass[hidelinks,a4paper,12pt]{article}
\usepackage[left=2in, right=1in, top=1in, bottom=1in]{geometry}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\usepackage{sectsty} %to customise headings
\usepackage{times} %this is for the selection of font
\usepackage{float}
\usepackage{fancyhdr}   
\usepackage[ampersand]{easylist}
\usepackage{amssymb}
\usepackage{enumitem}   
\usepackage{caption} \captionsetup[table]{singlelinecheck=false, margin=1em}
%\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{eso-pic}
%\usepackage{transparent}
\usepackage{pdfpages}
\usepackage{tocloft}

%\usepackage{ltablex}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{-15pt}

\usepackage{array}
\usepackage{tabularx}

\usepackage{rotating}
\usepackage{tikz}


\begin{document}

\section{Section 1}

\begin{sidewaysfigure}
    \centering
        \begin{figure}[H]
        \centering
        \includegraphics[ width=\textwidth , keepaspectratio ]{MainScreen.png}\\[-1em]
        \caption{Customer Login Screen}
        \vspace{0.25cm}
        \label{fig:2}
        \end{figure}        
\end{sidewaysfigure}

\begin{center}
    {
    \setlength{\extrarowheight}{2pt}

    \newcolumntype{b}{X}
    \newcolumntype{s}{>{\hsize=.4\hsize}X}
    \newcolumntype{t}{>{\hsize=1.3\hsize}X}

    \renewcommand\thetable{2}                   
    \captionof{table}{ \textbf {\small {Customer Login Screen}}} \label{table:2}
    \vspace{0.25cm}

    \begin{tabularx}{\textwidth}{ | >{\ttfamily\raggedright\arraybackslash} s 
    | >{\ttfamily\raggedright\arraybackslash} t 
    | >{\ttfamily\raggedright\arraybackslash} t | }

    \hline

    {\textbf{\textcolor{black}{{Sr. No.} \newline}}} & {\textbf{\textcolor{black}{{Input Element}}}} & \textbf{\textcolor{black}{{Description \& Behaviour}}} \\

    \hline
    1.0 & Username Input Field & Textbox to accept registered username. Email ID or any other unique attribute shall not be accepted \\
    \hline      
    2.0 & Password Input Field & Textbox to accept password associated with the Username  \\
    \hline       
    3.0 & Submit Button & To post the Username and password entered by the user to the server  \\
    \hline  
    4.0 & Alert & To notify User of incorrect or empty Username and / or password or an expired User session  \\
    \hline                                                              
    \end{tabularx}
    }
\end{center}

\begin{sidewaysfigure}
    \centering
        \begin{figure}[H]
        \centering
        \includegraphics[ width=\textwidth , keepaspectratio ]{LoginValidation.png}\\[-1em]
        \vspace{0.25cm}
        \caption{Customer Login Screen - Alert}
        \label{fig:2}
        \end{figure}
\end{sidewaysfigure}

\section{Section 2}

\end{document}

我正在使用 PDFLatex 和 Texstudio 进行编译。希望得到建议。谢谢!

答案1

正如你在文本中定义的那样,这些数字是漂浮的元素(因为您使用环境figure),而表格是常规文本元素。此外,图像的大小可能与您想要的大小不同:设置宽度(将是垂直延伸)会使\textwidth图像非常大,因此它们可能超出浮动可能占用的文本的允许百分比。您不必摆弄放置参数,也可以将图像也设置为文本元素,如下所示:

\begin{sideways}
  \begin{minipage}{0.5\textwidth}
  \includegraphics[ width=\textwidth , keepaspectratio ]{example-image-a}\\
  \captionof{figure}{Customer Login Screen\label{fig:1}}
  \end{minipage}
\end{sideways}

\textwidth请注意,参数中的第一个指minipage的是整个文本的文本宽度,而第二个指的是内的文本宽度minipage

相关内容