Skip to content

Instantly share code, notes, and snippets.

@sycobuny
Last active December 25, 2015 05:59
Show Gist options
  • Save sycobuny/6929118 to your computer and use it in GitHub Desktop.
Save sycobuny/6929118 to your computer and use it in GitHub Desktop.
Trying to figure out how to apply a nesting of \newenvironment in a manner reminiscent of OO inheritance (at least, that's the way it stacks in my brain)
\newenvironment{someSection}{%
% some \newcommands go here
\header{Some Section}%
\addvspace{\vpad}%
\begin{adjustwidth}{\extraMargin}{\extraMargin}%
}{%
\end{adjustwidth}%
\addvspace{\vpad}%
}
\newenvironment{someOtherSection}{%
% some different \newcommands go here
\header{Some Other Section}%
\addvspace{\vpad}%
\begin{adjustwidth}{\extraMargin}{\extraMargin}%
}{%
\end{adjustwidth}%
\addvspace{\vpad}%
}
% having noticed that my \addvspace and adjustwidth environments were repeated,
% I decided to make the following environment, but I can't figure out how to
% apply it.
\newenvironment{thinpara}{%
\addvspace{\vpad}%
\begin{adjustwidth}{\extraMargin}{\extraMargin}%
}{%
\end{adjustwidth}%
\addvspace{\vpad}%
}
% it almost seems like macros that individually expand to \begin and \end
% would be easier/more possible in general:
\newcommand{\thinStart}{%
\addvspace{\vpad}%
\begin{adjustwidth}{\extraMargin}{\extraMargin}%
}
\newcommand{\thinEnd}{%
\end{adjustwidth}%
\addvspace{\vpad}%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment