如何让表格和文字并排显示?

如何让表格和文字并排显示?

我正在使用这个序言

\documentclass[11pt]{book}
\usepackage[paperheight=9.5in,paperwidth=8in, top=1in, bottom=0.8in, twocolumn]{geometry}
\setlength{\columnseprule}{0.4pt}
\usepackage{amssymb,amsfonts}
\usepackage{mathrsfs}
\usepackage[centertags]{amsmath}
\usepackage{amsthm}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\usepackage{epsfig}
\usepackage{float}


\usepackage{graphicx}\graphicspath{{Graphics/}}
\usepackage{mathptmx}
\usepackage[square,sort&compress]{natbib}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{arrows}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}\pagestyle{fancy}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{booktabs}

\usepackage{enumitem}
\setlist[enumerate,2]{label=(\roman*).}
\usepackage{tasks}
\settasks{label=$\circ$}
\usepackage{tikz}
\usetikzlibrary{fit, tikzmark}       
\tikzset{FIT/.style = {
        draw=black, thick, inner sep=2pt, rounded corners, fit=#1,
        node contents={}},
    s/.style= {inner xsep=6pt}
}


%\usepackage{hyperref}
\usetikzlibrary{arrows.meta}
\renewcommand{\baselinestretch}{1.5}
\newcommand\aug{\fboxsep=-\fboxrule\!\!\!\fbox{\strut}\!\!\!}
\theoremstyle{definition}
\newtheorem{Thm}{Theorem}[section]
\newtheorem{lem}[Thm]{Lemma}
\newtheorem{pro}[Thm]{Proposition}
\newtheorem{de}[Thm]{Definition}
\newtheorem{re}[Thm]{Remark}
\newtheorem{ex}[Thm]{Example}
\newtheorem{cor}[Thm]{Corollary}
\numberwithin{equation}{section}
\definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\begin{document}
 \begin{tabular}{|c|c|c|}\hline
    \text{Marks}&\text{Frequency} $f$&\text{Cumulative Frequecny}\\\hline
    \text{0---10}&3&3\\
    \text{10---20}&5&8\\
    \text{20---30}&9&17\\
    \text{30---40}&3&20\\
    \text{40---50}&2&22\\\hline
\end{tabular}\qquad
Location of $Q_1=\dfrac{n}{4}th$ item$=\dfrac{22}{4}th$ item$=5.5$th item\\
Location of $Q_3=\dfrac{3n}{4}th$ item$=3\dfrac{22}{4}th$ item$=16.5$th item
\end{document}

但它就像图片所示 在此处输入图片描述

答案1

我建议你将tabular环境和方程式都放在table*figure*环境中。这样,它们就可以并排摆放。

在此处输入图片描述

\documentclass[11pt]{book}
\usepackage[paperheight=9.5in,paperwidth=8in, 
            top=1in, bottom=0.8in, 
            %% what about width of the side margins?
            twocolumn]{geometry}
\setlength{\columnseprule}{0.4pt}
\usepackage{amssymb} %%%%%,amsfonts}
\usepackage{mathrsfs}
\usepackage[centertags]{amsmath}
%%%%%%\usepackage{amsmath}
%%%%%\usepackage{epsfig}
%%%%%\usepackage{float}


\usepackage{graphicx}\graphicspath{{Graphics/}}
\usepackage{mathptmx}
\usepackage[square,sort&compress]{natbib}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{arrows}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}\pagestyle{fancy}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{booktabs}

\usepackage{enumitem}
\setlist[enumerate,2]{label=(\roman*).}
\usepackage{tasks}
\settasks{label=$\circ$}
\usepackage{tikz}
\usetikzlibrary{fit, tikzmark}       
\tikzset{FIT/.style = {
        draw=black, thick, inner sep=2pt, rounded corners, fit=#1,
        node contents={}},
    s/.style= {inner xsep=6pt}
}

\usepackage{hyperref}
\usetikzlibrary{arrows.meta}
%%%%\renewcommand{\baselinestretch}{1.5}
\setstretch{1.5}

\newcommand\aug{\fboxsep=-\fboxrule\!\!\!\fbox{\strut}\!\!\!}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}

\theoremstyle{definition}
\newtheorem{Thm}{Theorem}[section]
\newtheorem{lem}[Thm]{Lemma}
\newtheorem{pro}[Thm]{Proposition}
\newtheorem{de}[Thm]{Definition}
\newtheorem{re}[Thm]{Remark}
\newtheorem{ex}[Thm]{Example}
\newtheorem{cor}[Thm]{Corollary}

\numberwithin{equation}{section}
\definecolor{uuuuuu}{rgb}{0.26667,0.26667,0.26667}

\begin{document}

\begin{table*} % will be placed at top of next pages
\begin{minipage}{\columnwidth}
\centering
\begin{tabular}[t]{|r|c|c|}
    \hline
    Marks & Freq.\ $f$ & Cum.\ Freq. \\
    \hline
    \text{0--10} &3& 3\\
    \text{10--20}&5& 8\\
    \text{20--30}&9&17\\
    \text{30--40}&3&20\\
    \text{40--50}&2&22\\\hline
\end{tabular}
\end{minipage}\hfill
\begin{minipage}{\columnwidth}
\begin{align*}
\text{Location of $Q_1$}
   &=\tfrac{1}{4}n\,\text{th item}\\
   &=\tfrac{22}{4}\,\text{th item}\\
   &=5.5\,\text{th item}\\
\text{Location of $Q_3$}
   &=\tfrac{3}{4}n\,\text{th item}\\
   &=\tfrac{3\cdot22}{4}\,\text{th item}\\
   &=16.5\,\text{th item}
\end{align*}
\end{minipage}
\end{table*}

\end{document}

相关内容