如何编辑 .cls 中的 \newenvironment{table}

如何编辑 .cls 中的 \newenvironment{table}

你可以获取“jfm.cls”代码 http://journals.cambridge.org/data/relatedlink/jfm-ifc.zip

在“jfm.cls”中重新定义的表如下

\newcounter{table}
\renewcommand\thetable{\@arabic\c@table}
\def\fps@table{tp}
\def\ftype@table{1}
\def\ext@table{lot}
\newcommand\tablename{Table}
\def\fnum@table{\tablename~\thetable}

\newif\iffollowon
\newif\ifrmrule

\newcommand\followon{\global\followontrue}
\newcommand\norule{\global\rmruletrue}

\newenvironment{table}
  {\@float{table}\fstyle@table
   \iffollowon \else \vspace*{9.5\p@}\fi
   \global\followonfalse
   \rule{\textwidth}{.5\p@}\vskip\floatsep\relax}
  {\ifrmrule \global\rmrulefalse \else \rule{\textwidth}{.5\p@}\fi
   \end@float}


\newenvironment{table*}{\@dblfloat{table}\fstyle@table}{\end@dblfloat}
\newenvironment{plaintable}{\@float{table}\fstyle@table}{\end@float}

\def\fstyle@table{\normalfont\small\rmfamily}
\def\fjust@table{\centering}
\def\fcapjust@table{\centering}
\def\fcapsize@table{\normalfont\small\scshape}
\def\fcapstyle@table{\normalfont\small\rmfamily}

当我使用表格时,它总是在顶部。如何编辑以使其不浮动或以其他方式使其位于部分标题下方。

在此处输入图片描述

代码如下

% This is file according to the JFM2esam.tex
% Copyright (C) 1996, 1997 Cambridge University Press

\NeedsTeXFormat{LaTeX2e}

\documentclass{jfm}

\usepackage{graphicx}
\usepackage{natbib}


\title[Guidelines for authors]{Guidelines for authors and submission template}

\author[A. N. Other, H.-C. Smith and J. Q. Public]%
{Alan N. Other$^1$%
  \thanks{Email address for correspondence: [email protected]},\ns
H. - C. Smith$^1$\break
and J. Q.  Public$^2$}

% NOTE: A full address must be provided: department, university/institution, town/city, zipcode/postcode, country.
\affiliation{$^1$Department of Chemical Engineering, University of America,
Somewhere, IN 12345, USA\\[\affilskip]
$^2$Department of Aerospace and Mechanical Engineering, University of
Camford, Academic Street, Camford CF3 5QL, UK}

\pubyear{2010}
\volume{650}
\pagerange{119--126}
% Do not enter received and revised dates. These will be entered by the editorial office.
\date{?; revised ?; accepted ?. - To be entered by editorial office}
%\setcounter{page}{1}
\begin{document}

\maketitle

\begin{abstract}
This file contains instructions for authors planning to submit a paper to the {\it Journal of Fluid Mechanics}. These instructions were generated in {\LaTeX} using the JFM style, so the {\LaTeX} source file can be used as a template for submissions. The present paragraph appears in the \verb}abstract} environment. All papers should feature a single-paragraph abstract of no more than 250 words, which provides a summary of the main aims and results.
\end{abstract}

\begin{keywords}
Authors should not enter keywords on the manuscript, as these must be chosen by the author during the online submission process and will then be added during the typesetting process (see http://journals.cambridge.org/data/\linebreak[3]relatedlink/jfm-\linebreak[3]keywords.pdf for the full list)
\end{keywords}

\section{How to submit to the \textbf{\textit{Journal of Fluid Mechanics}}}
Authors must submit using the online submission and peer review system, Scholar One Manuscripts (formerly Manuscript Central) at http://mc.manuscriptcentral.com/jfm. If visiting the site for the first time, users must create a new account by clicking on `register here'. Once logged in, authors should click on the `Corresponding Author Centre', from which point a new manuscript can be submitted, with step-by-step instructions provided. Authors must at this stage specify whether the submission is a standard paper, or a {\it JFM Rapids} paper (see  for more details). In addition, authors must specify an editor to whom the paper will be submitted from the drop-down list provided. Note that all editors exclusively deal with either standard papers or {\it JFM Rapids} (clearly indicated on the list), so please ensure that you choose an editor accordingly. Once your submission is completed you will receive an email confirmation.  Book reviews should not be submitted via the online submission site and should instead be submitted by email to [email protected].

\section{Rules of submission}\label{sec:rules_submission}
Submission of a paper implies a declaration by the author that the work has not previously been published, that it is not being considered for publication elsewhere and that it has not already been considered by a different editor of the Journal. Note that a report on a conference must be submitted within 3 months of the meeting.

\section{Types of paper}\label{sec:types_paper}
\subsection{Standard papers}
Regular submissions to JFM are termed `standard papers'. Note that such papers must contain original research, as review articles are not published in JFM. Papers should be written in a concise manner; though JFM has no page limit, each paper will be judged on its own merits, and those deemed excessive in length will be rejected or will require significant revision.
\subsection{JFM Rapids}
{\it JFM Rapids} is an evolution of the Fast Track scheme, and is devoted to the rapid publication of short, high-impact papers across the full range of fluid mechanics. {\it Rapids}  must occupy 10 or fewer printed pages, and must be submitted in {\LaTeX} using the jfm.cls class file, so as to ensure that they meet the page limit and to expedite their production.  The principal and over-riding objective is to publish papers of the highest scientific quality. Once a paper is submitted, referees are asked to provide reports with a short turnaround.  In order to be accepted for publication in {\it JFM Rapids}, such papers must require only minor revisions to improve clarity, usually without recourse to a second round of refereeing.  Where the editor, guided by the referees, judges that a paper has merit but requires substantial revision that will require significant refereeing, a decision of `revise and resubmit' will be given. On re-submission, such papers will be handled as standard JFM papers and will not subsequently appear as {\it JFM Rapids}.

{\it Rapids} will be published online within one month of final acceptance.  They will appear within a new devoted section on the Journal of Fluid Mechanics website, which has been re-designed as part of this development. Each {\it Rapid} will still be cited and indexed as a JFM article but with a distinctive {\it Rapids} identifier, and will be assigned to a JFM volume. {\it Rapids} will not be included in the regular print versions of JFM, but a collection of all {\it Rapids} will be available to order in print at the end of each year. {\it JFM Rapids} will have free colour and for the first year of operation will be freely accessible to all.


\appendix
\section{}\label{appA}

\begin{table}
  \begin{center}
\def~{\hphantom{0}}
  \begin{tabular}{lccc}
      $a/d$  & $M=4$   &   $M=8$ & Callan  \\[3pt]
       0.1   & 1.56905 & ~~1.56~ & 1.56904\\
       0.3   & 1.50484 & ~~1.504 & 1.50484\\
       0.55  & 1.39128 & ~~1.391 & 1.39131\\
       0.7   & 1.32281 & ~10.322 & 1.32288\\
       0.913 & 1.34479 & 100.351 & 1.35185\\
  \end{tabular}
  \caption{Values of $kd$ at which trapped modes occur when $\rho(\theta)=a$}
  \label{tab:kd}
  \end{center}
\end{table}



\end{document}

然后我得到了@masu 的建议,它制作了下面的表格,但得到了像上面一样的更多空白空间 在此处输入图片描述

@masu 解决问题了。然后如果我添加 \newpage,它只会使表格底部像这样。如何解决。

在此处输入图片描述

答案1

如果这是一份官方日志cls文件,你就不应该更改它。我想是的。

这是一个简单易行的解决方案,它保留类定义,但不会在附录中的浮点数实际开始之前消失。

使用包\FloatBarrier的宏placeins。如果你把它放在章节标题之前,它将阻止浮动元素越过它。


我不太确定这是否总是有效,但可以解决你的这个问题。

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@float}{\csname fps@#1\endcsname}{b!}{}{}
\makeatother

如果您只想在某些地方改变行为:

  1. 把这写在你的序言中:

    \usepackage{xpatch}
    
  2. 把它们放在你想要强制底部对齐的地方:

    \makeatletter
    \let\@float@original\@float
    \xpatchcmd{\@float}{\csname fps@#1\endcsname}{b!}{}{}
    \makeatother
    

    ...

    \makeatletter
    \let\@float\@float@original
    \makeatother
    

相关内容