widetext.sty 2.4 KB

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