1

This question is inspired by Gonzalo's great answer here concerning his creation of gridleno.sty to enhance the functionality of grid.sty.

Ultimately I have two seemingly simple questions (please let me know if I should post the questions separately if needed), but I have not been able achieve my desired effect despite some fiddling around with parameters and the like.

(1): How could the summary box/environment be modified to have 10pt indentation uniformly instead of it just being indented on both sides as it currently is (I think it looks weird to have zero indentation on top and bottom, like the box is rather crammed):

enter image description here

Relevant snippet:

% environment for a summary
\newenvironment{summary}
  {\grcmpage{\linewidth}{summarybg}
   \hfil{\color{summaryhead}\bfseries\summaryname}\hfil\par%
     \parshape 1 10pt \dimexpr\linewidth-20pt\relax\itshape}
  {\par\endgrcmpage\par\prevdepth\tpd}

(2): This question is less important because I know a "workaround," but it doesn't seem very efficient. I really like the exercises environment in gridleno.sty:

enter image description here

Relevant snippet:

% environment for exercises: facy title and redefines enumerate as exenumerate
% to remove labels indentation
\newenvironment{exercises}
  {\section*{\Hrulefill\quad%
    {\bfseries\exercisesname}\quad\Hrulefill}%
  \let\enumerate\exenumerate\let\endenumerate\endexenumerate}
  {}

I would like to use this environment but have flexibility with different headings. For example, I would also like to have a solutions environment that functioned exactly as the exercises environment here, and I can do this by simply creating the new environment in gridleno.sty but the most efficient approach here, it seems, would be something along the lines of having an optional argument for the exercises environment, much as the AMS proof environment has an optional argument such as \begin{proof}[Solution]...\end{proof}.

If possible, I'd like to have \begin{exercises}[<heading>]...\end{exercises} to where I could use "Solutions" as one heading or something completely different. This would be much nicer, I think, than simply duplicating code almost but changing one word here and one word there (but I don't know how to modify the exercise environment to do this).

Any ideas?

1

Untested as you don't provide working code, but for the second question

\newenvironment{exercises}[1][Exercises]
  {\section*{\Hrulefill\quad%
    {\bfseries #1}\quad\Hrulefill}%
  \let\enumerate\exenumerate\let\endenumerate\endexenumerate}
  {}

would let you say

\begin{exercises}
  \item items with Exercises as title
\end{exercises}

or

\begin{exercises}[Solutions]
  \item items with Solutions as title
\end{exercises}

Probably. Hard to know without knowing how all the bits there are defined. Might not work at all. But, heck, if you wanted working code, you'd have provided a Minimum Working Example so I could test it.

  • 1
    I don't see any reason to be edgy here--I can provide a MWE if desired, but I refrained from doing so in order to prevent a rather long post from being much longer. I left Gonzalo a comment from an earlier interaction with him today in case he wanted to address this (originally was going to ask him in a comment, but this seemed enough to warrant a new question). Regardless, I can confirm that your solution for my second question checks out. Thank you. – Daniel W. Farlow Aug 7 '15 at 4:19

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.