荣斋居士分享 http://blog.sciencenet.cn/u/dalianwang

博文

LaTeX双栏单栏设置

已有 13246 次阅读 2022-1-13 09:56 |个人分类:软件学习|系统分类:科研笔记

情形1:LaTeX模板是双栏

任务1:如何设置公式为单栏显示?

需要加载包

\usepackage{widetext}

示例:

\begin{widetext}
    \begin{equation}
    	\tau_{ij}(t+1)= \begin{cases}\frac{(1-\rho) \tau_{ij}(t)}{X(j)}+\mu\left(\left|D_{\text {worst }}\right|-\left|D_{\text {best}}\right|\right) & i, j \in D_{\text {best }} \\
    		\frac{(1-\rho) \tau_{ij}(t)}{X(j)}-\mu\left(\left|D_{\text {worst }}\right|-\left|D_{\text {best}}\right|\right) & i, j \in D_{\text {worst}} \\
    		0, & \text {other}\end{cases}
    \end{equation}
\end{widetext}

结果如下图所示:

image.png


任务2:如何设置(宽)表格单栏显示?

将\begin{table} 和\end{table}改为:\begin{table*} 和\end{table*}

示例:

\begin{table}[htbp]
\centering
\caption{List of abbreviated names}
\begin{tabular}{cc}
\hline\hline
Names                                      & Abbreviations \\
\hline
Huaian Xinya International Business Circle & HXIBC         \\
Huayangcheng Community                     & HYC           \\
Shuguang International Business Circle     & SIBC          \\
Xinya International Building               & XIB           \\
Golden Eagle International Shopping Center & GEISC         \\
Shidai Square                              & SDS           \\
Nanping Yuan                               & NPY           \\
Huaihai First City                         & HFC           \\
Chengde Mountain Villa                     & CMV           \\
Anshe Bridge                               & ASB           \\
Huaihai Garden                             & HHG           \\
\hline\hline
\end{tabular}
\label{tab:jianxie}
\end{table}

image.png

改为:

\begin{table}[htbp]
\centering
\caption{List of abbreviated names}
\begin{tabular}{cc}
\hline\hline
Names                                      & Abbreviations \\
\hline
Huaian Xinya International Business Circle & HXIBC         \\
Huayangcheng Community                     & HYC           \\
Shuguang International Business Circle     & SIBC          \\
Xinya International Building               & XIB           \\
Golden Eagle International Shopping Center & GEISC         \\
Shidai Square                              & SDS           \\
Nanping Yuan                               & NPY           \\
Huaihai First City                         & HFC           \\
Chengde Mountain Villa                     & CMV           \\
Anshe Bridge                               & ASB           \\
Huaihai Garden                             & HHG           \\
\hline\hline
\end{tabular}
\label{tab:jianxie}
\end{table}

结果如下:


image.png


情形2:LaTeX模板为单栏

任务1:如何变双栏?

加在要设置的段落前加一行命令:

\doublespace


任务2:如何再返回单栏?


加在要设置的段落前加一行命令:

\singlespace


注意:widetext包

上文提到的widetext包可以自己制作,“widetext.sty”,具体内容为:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{widetext}

%% Mimics the widetext environment of revtex4 for any other class package
%% Eg: article.cls
%%
%% Compiled by: Anjishnu Sarkar
%%
%% Advantages:
%% *) Supports float (eg: figure) in two column format (Advantage over
%%      multicol package)
%% *) One and twocolumn exist on the same page
%% *) Flow of text shown via rule
%% *) Equal height of text when in two column format
%%
%% Acknowledgment(s):
%% 1. Instead of re-inventing the wheel, two packages (flushend, cuted) of
%% the sttools bundle are used. The sttools bundle is available from CTAN.
%% Lisence of these packages rests with their corresponding author.
%% Any bug/problem with flushend and cuted should be forwarded to their
%% corresponding package authors.
%% 2. The idea of the rule came from the following latex community website
%% http://www.latex-community.org/forum/viewtopic.php?f=5&t=2770
%%
%% This package just defines the widetext environment and the rules.
%%
%% Usage:
%% \documentclass[a4paper,12pt,twocolumn]{article}
%% \usepackage{widetext}
%%
%% \begin{document}
%%
%% Some text in twocolumn
%%
%% \begin{widetext}
%% Text in onecolumn format.
%% \end{widetext}
%%
%% Some more text in twocolumn
%%
%% \end{document}
%%%%%%%%%%%%%%%%%%%%

%% Package required for equal height while in 2 columns format
\IfFileExists{flushend.sty}
    {\RequirePackage{flushend}}
    {\typeout{}
    \typeout{Package widetext error: Install the flushend package which is
    a part of sttools bundle. Available from CTAN.}
    \typeout{}
    \stop
    }

%% Package required for onecolumn and twocolumn to exist on the same page.
%% and also required for widetext environment.
\IfFileExists{cuted.sty}
    {\RequirePackage{cuted}}
    {\typeout{}
    \typeout{Package widetext error: Install the cuted package which is
    a part of sttools bundle. Available from CTAN.}
    \typeout{}
    \stop
    }


\newlength\@parindent
\setlength\@parindent{\parindent}

\if@twocolumn
    \newenvironment{widetext}
        {%
            \begin{strip}
            \rule{\dimexpr(0.5\textwidth-0.5\columnsep-0.4pt)}{0.4pt}%
            \rule{0.4pt}{6pt}
            \par %\vspace{6pt}
            \parindent \@parindent
        }%
        {%
            \par
            \hfill\rule[-6pt]{0.4pt}{6.4pt}%
            \rule{\dimexpr(0.5\textwidth-0.5\columnsep-1pt)}{0.4pt}
            \end{strip}
        }
\else
    \newenvironment{widetext}{}{}
\fi






https://wap.sciencenet.cn/blog-2089193-1320819.html

上一篇:[转载]傅里叶变换和神经网络
下一篇:推荐一个高效的科研网站
收藏 IP: 124.16.148.*| 热度|

1 杨学祥

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

全部作者的精选博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-16 04:15

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部