I recently stumbled upon the tufte-latex class and I must say that I
have enjoyed experimented with it!
I noticed in the tufte-handout.cls file that there is no environment
for margin figures. After some experimentation I managed to come up
with this (see also the attached patch file):
----
%%
% Margin figure environment
\newsavebox{\@tufteh@marginfigbox}
\newenvironment{marginfig}[1]
[-1.2ex]
{\FloatBarrier% process all floats before this point so the figure
numbers stay in order.
\begin{lrbox}{\@tufteh@marginfigbox}
\begin{minipage}{\marginparwidth}
\@tufteh@marginfont
\def\@captype{figure}
\vspace*{#1}
\@tufteh@raggedright
}
{\end{minipage}%
\end{lrbox}%
\marginpar{\usebox{\@tufteh@marginfigbox}}}
---
Not sure about the robustness of my code, but it seems to work. Now
you can write
\begin{marginfig}
\includegraphics{fig}
\caption{A margin figure}
\end{marginfig}
instead of
\marginfigure{
\includegraphics{fig}
\caption{A margin figure}
}
Regards,
Kjell Magne Fauske
http://www.fauskes.net
Hi.
> I recently stumbled upon the tufte-latex class and I must say that I
> have enjoyed experimented with it!
Good news.
> I noticed in the tufte-handout.cls file that there is no environment
> for margin figures. After some experimentation I managed to come up
> with this (see also the attached patch file):
Excellent, thanks! This addresses the tufte-handout.cls comment:
FIXME: if anyone can make this an environment instead -- patch welcome!
Regards,
--
http://twitter.com/bil_kleb
>
> > I noticed in the tufte-handout.cls file that there is no environment
> > for margin figures. After some experimentation I managed to come up
> > with this (see also the attached patch file):
> >
>
> Excellent, thanks! This addresses the tufte-handout.cls comment:
>
> FIXME: if anyone can make this an environment instead -- patch welcome!
>
That's why I gave it a try :)
A margin table environment can be implemented in the same way:
---------------
%%
% Margin table environment
\newsavebox{\@tufteh@margintablebox}
\newenvironment{margintab}[1]
[-1.2ex]
{\FloatBarrier% process all floats before this point so the figure
numbers stay in order.
\begin{lrbox}{\@tufteh@margintablebox}
\begin{minipage}{\marginparwidth}
\@tufteh@marginfont
\def\@captype{table}
\vspace*{#1}
\@tufteh@raggedright
}
{\end{minipage}%
\end{lrbox}%
\marginpar{\usebox{\@tufteh@margintablebox}}}
-------------
(Note that I have used the margintab name instead of margintable to
avoid breaking existing code)
I have only tested the environments in a trivial example document. It
would be nice if someone could test them in a more realistic document.
I tested out your marginfig and margintab environments and they worked
great for me. I've added them to our svn repository.
Thanks for your contribution!
--Kevin Godby
I was envisioning "instead", i.e., replace the old \marginfigure
\margintable commands with Kjell's environment versions. Currently,
both flavors are available.
Thoughts?
Regards,
--
http://twitter.com/bil_kleb
I'm glad to hear that my environments made it into the repository. I
named them marginfig and margintab to avoid breaking existing code
while experimenting. People are used to the figure environment, so a
marginfigure and tablefigure environment makes sense for consistency
reasons.
I have no documents that use the \marginfigure macro, so for me it is
no inconvenience to change it to an environment. For others the change
will require some manual editing.
Regards,
Kjell Magne Fauske
I considered that, but didn't know if I should leave the original
\margintable and \marginfigure commands for backward-compatibility or
not.
Are there any situations where the old non-environment commands might
work and the environment commands wouldn't? (That is, places where
you can use an environment but can still use a \marginpar.)
I'm all for simple replacing the original commands with the
environments, as long as there aren't any technical problems with
doing so.
--Kevin
You could also argue the other side, \marginpar is also standard LaTeX.
We're at the intersection of two worlds; but as I wrote early, I lean
toward your thinking.
> I have no documents that use the \marginfigure macro, so for me it is
> no inconvenience to change it to an environment. For others the change
> will require some manual editing.
Furthermore, breaking backward compatibility would allow us
to go to 2.0 and find out if anyone is actually using this class...
Regards,
--
Bil Kleb
http://slickorslack.com
I like the marginfigure and tablefigure environment names, as well.
>> I have no documents that use the \marginfigure macro, so for me it is
>> no inconvenience to change it to an environment. For others the change
>> will require some manual editing.
>
> Furthermore, breaking backward compatibility would allow us
> to go to 2.0 and find out if anyone is actually using this class...
Heh.. sounds like a plan to me!
I've attached a patch that removes the deprecated \marginfigure and
\margintable commands and uses the environment names `marginfigure'
and `margintable'.
--Kevin
Please commit it along with a bump to 2.0.
It's probably also time to think about releasing this package to CTAN?
I think there is a sketch of how in the release script?
Should we dtx-ify it?
Regards,
--
Bil
Committed. Version bumped.
> It's probably also time to think about releasing this package to CTAN?
> I think there is a sketch of how in the release script?
The release script just points to http://ctan.org/upload, which
contains instructions. It looks like the process is pretty
straightforward.
> Should we dtx-ify it?
Hmm.. probably not a bad idea.
I'm going to work on updating my sample-handout.tex document this
weekend. I'll document the class options, the various commands and
environments, some common tweaks that authors may wish to make (e.g.,
line justification, changing the running heads, defining more
headings), and I'll try to toss in a bit of design philosophy while
I'm at it. :-)
Are there any major features we're missing for 2.0.0? I've got a list
of things I'd like to tweak at some point, but none of them are too
terribly urgent.
--Kevin
>
>> It's probably also time to think about releasing this package to CTAN?
>> I think there is a sketch of how in the release script?
>
> The release script just points to http://ctan.org/upload, which
> contains instructions. It looks like the process is pretty
> straightforward.
>
There are some new guidelines for creating packages. See this recent
thread for details:
http://groups.google.com/group/comp.text.tex/browse_thread/thread/ef1ca096e0b4f3b9/3afbcc61e30b8fee
Recommended tds structure:
http://www.ctan.org/tds-guidelines.html
>> Should we dtx-ify it?
>
> Hmm.. probably not a bad idea.
>
- Kjell Magne Fauske
Thank you.
>> Should we dtx-ify it?
>
> Hmm.. probably not a bad idea.
I'm of two minds about it. It helps some of the automated
(La)TeX distributions like MiKTeX, but for other packages I've
done that way, I constantly get questions like "where is the class file?"
> I'm going to work on updating my sample-handout.tex document this
> weekend.
Excellent news.
> Are there any major features we're missing for 2.0.0? I've got a list
> of things I'd like to tweak at some point, but none of them are too
> terribly urgent.
Not that I can think of off hand. Besides if they don't break
backward compatibility, they only bump the minor version number...
Regards,
--
Bil