-
Notifications
You must be signed in to change notification settings - Fork 8
/
widetext.sty
89 lines (83 loc) · 2.74 KB
/
widetext.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
% copied from https://blog.pnas.org/widetext.sty, with some modifications via: https://tex.stackexchange.com/a/128289/224861
\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}
{%
\par \vspace{-\baselineskip} % <-- this line added
\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}
\par \vspace{-\baselineskip}\noindent % <-- this line added
}
\else
\newenvironment{widetext}{}{}
\fi