0

Consider the following sty file and note the two lines that are commented out, which I'll put in a file called sample1.sty.

\if@twocolumn\else\input twocolumn.sty\fi
\usepackage{mathptmx}  % times roman, including math (where possible)

\def\@maketitle{
% \vskip -4.5cm
 \vbox to 2.5in{
 \vspace*{\fill}
 \vskip 2em
 \begin{center}%
  {\Large\bf \@title \par}%
  \vskip 0.375in minus 0.300in
  {\large\it
   \lineskip .5em
   \begin{tabular}[t]{c}\@author
   \end{tabular}\par}%
 \end{center}%
 \par
 \vspace*{\fill}
 }
%\vskip -2.5cm
}

\def\abstract{\begin{center}%
{\large\bf \abstractname\vspace{-.5em}\vspace{\z@}}%
\end{center}}
\def\endabstract{}

\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus-1ex minus
    -.2ex}{2.3ex plus.2ex}{\reset@font\large\bf}}

Now consider the following latex file and again note the two lines that are commented out.

\documentclass[letterpaper,twocolumn,10pt]{article}
\usepackage{sample1,epsfig,endnotes}
\begin{document}

\title{\Large \bf Wonderful : A Terrific Application and Fascinating Paper}

%\vskip -4.5cm
\maketitle
%\vskip -2.5cm

\thispagestyle{empty}

\subsection*{Abstract}
Your Abstract Text Goes Here.

\section{Introduction}

\end{document}

If we comment in the two lines in the tex file, there is no observable change in appearance. However, if we insteead comment in the two lines in the sty file, we shrink a lot of the whitespace.

How can we achieve the same effect as uncommenting the two lines in the sty file while only modifying the tex file?

1

Since you are lucky and you need just to change the command before and after only (and not in its between) you can redefine it with an easy way like this in your tex file:

\documentclass[letterpaper,twocolumn,10pt]{article}

%IGNORE THIS LINES YOU HAVE THEM IN THR STY BUT I NEED THEM FOR THE EXAMPLE
\makeatletter
\def\@maketitle{
%\vskip -4.5cm
 \vbox to 2.5in{
 \vspace*{\fill}
 \vskip 2em
 \begin{center}%
  {\Large\bf \@title \par}%
  \vskip 0.375in minus 0.300in
  {\large\it
   \lineskip .5em
   \begin{tabular}[t]{c}\@author
   \end{tabular}\par}%
 \end{center}%
 \par
 \vspace*{\fill}
 }
%\vskip -2.5cm
}\makeatother
% END OF IGNORED LINES

% TITLE USUALLY DEFINED BEFORE \begin{document}
\title{\Large \bf Wonderful : A Terrific Application and Fascinating Paper}

%HERE IS THE PART THAT MAKES THE WORK
\makeatletter
\let\oldmaketitle\@maketitle
\def\@maketitle{\vskip -4.5cm\oldmaketitle\vskip -2.5cm}
\makeatother

\begin{document}

%\vskip -4.5cm
\maketitle
%\vskip -2.5cm

\thispagestyle{empty}

\subsection*{Abstract}
Your Abstract Text Goes Here.

\section{Introduction}

\end{document}

Output: same as if you change the sty.

Also, since you have a code of a part that you want to change, you can leave the sty file as it is, and redefine all the command like the "ignored text" of my above example... You could use it and change it in your tex file. It's definition would override the previous loaded from the package (since it is defined via def)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.