Margin figure positioning

3,976 views
Skip to first unread message

James Casbon

unread,
Feb 19, 2010, 8:30:17 AM2/19/10
to tufte-latex
Hi,

First of all thanks for this excellent project.

However, when using margingfigure, the figures can overflow over the
page border. Is there any way to prevent this and reposition the
other figures? Or to allow a figure to be placed on another page if
their is no room?

thanks,
James

Dan T. Abell

unread,
Feb 19, 2010, 9:10:52 AM2/19/10
to tufte...@googlegroups.com
If you use \includegraphics, then
\includegraphics[width=\textwidth]{figname}
should do the job. This will scale the figure
up or down. You may also give an explicit size
(e.g., 1.2in, or whatever.

-Dan

> --
> You received this message because you are subscribed to the Google
> Groups "tufte-latex" group.
> To post to this group, send email to tufte...@googlegroups.com.
> To unsubscribe from this group, send email to tufte-latex...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/tufte-latex?hl=en
> .

--
Dan T. Abell :: dabell at txcorp dot com :: 303.444.2452
Tech-X Corp., 5621 Arapahoe Ave, Ste A, Boulder CO 80303
http://www.txcorp.com :: 303.748.6894/c 303.448.7756/fx


Kevin Godby

unread,
Feb 19, 2010, 4:28:14 PM2/19/10
to tufte...@googlegroups.com
Hello, James.

You can adjust the vertical position of the margin figures using an
optional argument:

\begin{marginfigure}[-3\baselineskip]% negative values move the
figure up the page, positive down
\includegraphics[width=\linewidth]{mypic}% the \linewidth variable
is the width of the line, so it's the margin width or the text width,
depending on where the graphic is placed
\caption{This is a margin figure.}
\label{fig:marginfig}
\end{marginfigure}

Does that solve your problem?

--Kevin

James Casbon

unread,
Feb 23, 2010, 7:19:04 AM2/23/10
to tufte-latex

It is possible to solve the problem this way, but that means I have to
manually position page elements based on the current rendering of the
document. If the proceeding text changes, the page boundaries may do
as well and that requires that I recheck all the offsets manually.

I suppose my question is really this: if I generate a document and it
produces problems with the figures (such as overlapping margin and
fullwidth figures or figures that go off the edge of the page), should
I consider this a bug and submit this here, or should I just use the
offsets to manually fix it?

James

Kevin Godby

unread,
Feb 23, 2010, 7:24:25 AM2/23/10
to tufte...@googlegroups.com
Hello, James.

On Tue, Feb 23, 2010 at 6:19 AM, James Casbon <cas...@gmail.com> wrote:
> It is possible to solve the problem this way, but that means I have to
> manually position page elements based on the current rendering of the
> document.  If the proceeding text changes, the page boundaries may do
> as well and that requires that I recheck all the offsets manually.
>
> I suppose my question is really this:  if I generate a document and it
> produces problems with the figures (such as overlapping margin and
> fullwidth figures or figures that go off the edge of the page), should
> I consider this a bug and submit this here, or should I just use the
> offsets to manually fix it?

At this point, there's no easy solution for handling those situations.
Ultimately, I've it to know when a margin figure is running on top
of, say, a full-width figure. But the way LaTeX works right now,
there's no way to get that information (that I'm aware of).

My hope is that LaTeX 3 or LuaTeX will provide hooks that allows us to
keep track of those situations and work around them automatically, but
for the time being, we have to take care of that manually.

The best thing I can suggest at the moment is to finish writing your
document first: write the content, proofread all the text and
graphics. Then as a final pass, starting at the top of your document,
adjust the positions of the figures (margin and otherwise).

All that being said, if someone does have some ideas for dealing with
these kinds of problems automatically, please let me know!

--Kevin

Jorden Mauro

unread,
Feb 23, 2010, 11:45:05 AM2/23/10
to tufte...@googlegroups.com

Hello,

Due in part to this problem Kevin mentioned with LaTeX itself, and
partly to the mode of composition when using LaTeX, I include all my
figures and leave them maladjusted until the end. Once the text is
complete, then I tend to the visuals, though I make sure I place all
the visuals roughly in order and write the prose mostly around them,
unless a better order comes to me while writing. I think my
presentation is better when I follow this process; here are the main
steps:

1. Choose all graphic elements for the document, and place them in a
sensible (but not permanent) order
2. Compose the entire prose of the document, placing images in
approximate locations sans scaling. This helps your prose fit with the
graphics much better in my opinion.
3. Examine the result of the first two steps, properly scaling (and
sometimes moving) graphics, rewording text as necessary to fit said
movement.

For some of my most important work (creating `visual hiking guides'),
this helps me to get the visuals in the correct order, make relevant
text flow near the graphics, and to move `surprises' to a hidden
future page (overleaf is the proper term, I think). The result is a
document that has some excitement, a technique which is great for
detailing hiking trips to historic ruins, which are full of surprises,
but which I think is a good and powerful technique no matter the
subject. Readers definitely seem to be more attentive compared to
other layouts I've used, though I would attribute most of that
attentiveness to Tuftean layout rather than anything I did.

Other, hopefully helpful, ideas when you're in this situation: use
dummy figures consisting of simple boxes as placeholders so you can
get a feel for the layout, even if it's incorrect. If you're fortunate
enough to have all similar-sized figures or images, you can find the
right scaling factors from trudging through one document, and every
document after that using similar-sized figures you will be able to
scale properly. Using the same resolution pictures for a series of
hiking guides I'm working on requires just 4 scale factors to make the
content suitable for textwidth, pagewidth, half-textwidth, and margin
sizes. I imagine that should be about the same for all tufte-latex
documents; you may need more, but not many more, scale factors for
your work. These four simple sizes can be combined for greater effect,
too -- e.g. sometimes I employ a textwidth graphic with two
half-textwidth graphics below it, where the larger is an overview, and
the smaller ones details of something in the main graphic.

I tried to attach a PDF of one of my guide, but gmail doesn't like the
size. If anyone is interested, email me off-list and I can try to get
it to you. Kevin, perhaps you might be interested in looking at it --
doesn't google groups allow you to put a gallery together? Would that
be something the group is interested in? I'd love to share and see
ideas of how tufte-latex can be used, and what works with it.

~j

Kevin Godby

unread,
Feb 23, 2010, 6:17:26 PM2/23/10
to tufte...@googlegroups.com
Hello, Jorden.

On Tue, Feb 23, 2010 at 10:45 AM, Jorden Mauro <jrm...@gmail.com> wrote:
*snip*


> I tried to attach a PDF of one of my guide, but gmail doesn't like the
> size. If anyone is interested, email me off-list and I can try to get
> it to you. Kevin, perhaps you might be interested in looking at it --
> doesn't google groups allow you to put a gallery together? Would that
> be something the group is interested in? I'd love to share and see
> ideas of how tufte-latex can be used, and what works with it.

Thanks for the explanation of your workflow!

I'd be happy to host a copy of your PDF (and even the source files
required to create, if you're willing to share them) on the
Tufte-LaTeX site. I'm always happy to host examples of the
Tufte-LateX document classes being used in the wild! You can email
the files to me directly at <god...@gmail.com> and I will upload them
to the site. (Alternatively, if you prefer that I link to your site,
send me the link instead.)

This offer is open to anyone else who has examples that use the
tufte-book and tufte-handout document classes. Feel free to send me
links or copies of your work and I'll post them to our site

There are a few examples already listed at the top of the site:
http://code.google.com/p/tufte-latex/

--Kevin

Jorden Mauro

unread,
Feb 23, 2010, 6:47:11 PM2/23/10
to tufte...@googlegroups.com
Hi Kevin,

On Tue, Feb 23, 2010 at 6:17 PM, Kevin Godby <god...@gmail.com> wrote:
> Hello, Jorden.
>
> On Tue, Feb 23, 2010 at 10:45 AM, Jorden Mauro <jrm...@gmail.com> wrote:
> *snip*
>> I tried to attach a PDF of one of my guide, but gmail doesn't like the
>> size. If anyone is interested, email me off-list and I can try to get
>> it to you. Kevin, perhaps you might be interested in looking at it --
>> doesn't google groups allow you to put a gallery together? Would that
>> be something the group is interested in? I'd love to share and see
>> ideas of how tufte-latex can be used, and what works with it.
>
> Thanks for the explanation of your workflow!

Welcome! I'm glad I hear about others' workflows through tufte-latex :-)

>
> I'd be happy to host a copy of your PDF (and even the source files
> required to create, if you're willing to share them) on the
> Tufte-LaTeX site.  I'm always happy to host examples of the
> Tufte-LateX document classes being used in the wild!  You can email
> the files to me directly at <god...@gmail.com> and I will upload them
> to the site.  (Alternatively, if you prefer that I link to your site,
> send me the link instead.)
>

*snip*

Gmail won't let me send anything over 4MB and my sample page us just
over 5MB due to high-resolution photos. The whole paper itself (12
pages) is a whopping 20MB. pdftk couldn't do anything about it because
it's just the images. However, I successfully uploaded the sample page
to the tufte-latex Google Group site, since there seems to be plenty
of space there in the downloads area. Feel free to move/copy/link it
to the Google code site. You're free to use it for anything
tufte-latex related :)

I hope our fellow users enjoy my humble sample, and I welcome comments!

I also have a test of my sparkline package that is small enough to
email, and is attached to this email. The sparkline package will
probably be merged into Andreas Loeffler's when I spruce it up a bit.
I also have a feature Tufte brainstormed on the AskET forum that no
one seems to have implemented yet! If you want, you can put this
sample on the site, since it does use the tufte-latex class.

Thanks,
Jorden

weather_IndianLakeNY.pdf
Reply all
Reply to author
Forward
0 new messages