Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: sagemathinc/cocalc-example-files
Path: blob/master/RMarkdown/rticles/pnas_article/widetext.sty
Views: 1170
1
\NeedsTeXFormat{LaTeX2e}
2
\ProvidesPackage{widetext}
3
4
%% Mimics the widetext environment of revtex4 for any other class package
5
%% Eg: article.cls
6
%%
7
%% Compiled by: Anjishnu Sarkar
8
%%
9
%% Advantages:
10
%% *) Supports float (eg: figure) in two column format (Advantage over
11
%% multicol package)
12
%% *) One and twocolumn exist on the same page
13
%% *) Flow of text shown via rule
14
%% *) Equal height of text when in two column format
15
%%
16
%% Acknowledgment(s):
17
%% 1. Instead of re-inventing the wheel, two packages (flushend, cuted) of
18
%% the sttools bundle are used. The sttools bundle is available from CTAN.
19
%% Lisence of these packages rests with their corresponding author.
20
%% Any bug/problem with flushend and cuted should be forwarded to their
21
%% corresponding package authors.
22
%% 2. The idea of the rule came from the following latex community website
23
%% http://www.latex-community.org/forum/viewtopic.php?f=5&t=2770
24
%%
25
%% This package just defines the widetext environment and the rules.
26
%%
27
%% Usage:
28
%% \documentclass[a4paper,12pt,twocolumn]{article}
29
%% \usepackage{widetext}
30
%%
31
%% \begin{document}
32
%%
33
%% Some text in twocolumn
34
%%
35
%% \begin{widetext}
36
%% Text in onecolumn format.
37
%% \end{widetext}
38
%%
39
%% Some more text in twocolumn
40
%%
41
%% \end{document}
42
%%%%%%%%%%%%%%%%%%%%
43
44
%% Package required for equal height while in 2 columns format
45
\IfFileExists{flushend.sty}
46
{\RequirePackage{flushend}}
47
{\typeout{}
48
\typeout{Package widetext error: Install the flushend package which is
49
a part of sttools bundle. Available from CTAN.}
50
\typeout{}
51
\stop
52
}
53
54
%% Package required for onecolumn and twocolumn to exist on the same page.
55
%% and also required for widetext environment.
56
\IfFileExists{cuted.sty}
57
{\RequirePackage{cuted}}
58
{\typeout{}
59
\typeout{Package widetext error: Install the cuted package which is
60
a part of sttools bundle. Available from CTAN.}
61
\typeout{}
62
\stop
63
}
64
65
66
\newlength\@parindent
67
\setlength\@parindent{\parindent}
68
69
\if@twocolumn
70
\newenvironment{widetext}
71
{%
72
\begin{strip}
73
\rule{\dimexpr(0.5\textwidth-0.5\columnsep-0.4pt)}{0.4pt}%
74
\rule{0.4pt}{6pt}
75
\par %\vspace{6pt}
76
\parindent \@parindent
77
}%
78
{%
79
\par
80
\hfill\rule[-6pt]{0.4pt}{6.4pt}%
81
\rule{\dimexpr(0.5\textwidth-0.5\columnsep-1pt)}{0.4pt}
82
\end{strip}
83
}
84
\else
85
\newenvironment{widetext}{}{}
86
\fi
87