christopheradams / tufte-latex

Automatically exported from code.google.com/p/tufte-latex
0 stars 1 forks source link

Captions as sidenotes #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Find a way to set captions as sidenotes.  If the figure/table fits in the
\textwidth, the caption should be a sidenote alongside the figure/table. 
If the figure/table stretches across the full page width, the caption
should be set as a sidenote above or below the figure/table.

Original issue reported on code.google.com by godbyk@gmail.com on 18 Dec 2008 at 12:23

GoogleCodeExporter commented 9 years ago
I played a little with the new captions. They are really neat. I changed the 
handout example file to get rid of some 
overfull hboxes. I also separated the two figures a little bit more so the 
captions do not overlap. I also had to 
delete line 872 of tufte-common.sty in r87 to not have text on top of the 
table. 

Something does not look right, but I cannot figure out what it is. Just above 
that line (872) the \renewenvironment{table}[1][htbp] has its } bracket. But 
the Irbox and minipage are still not closed.

I sometimes use a Figure fully integrated in the text without any caption. Now 
it prints 'Figure x:' in any case. 

Original comment by andytho...@web.de on 15 Apr 2009 at 9:30

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for taking a look at it.  I know that using \prevdepth can be kind of 
tricky,
so I'll have to work on it a bit.  \prevdepth basically aligns the contents of 
the
box on their baseline instead of on the bottom of the descenders.  So a box
containing letters with no descenders (such as [abcdef]) can be aligned at the
baseline with a box containing descenders (such as [gjpqy]).

I'm going to leave the too-close captions in the sample-handout for a bit so I 
can
use them as a test for getting the spacing to automatically work.  I'd like all 
the
margin material to be spaced in the same manner as margin notes.

As for the appearance of the mismatched braces:  The \newenvironment or
\renewenvironment commands take three parameters.  For example:

  \renewenvironment{figure}{start-figure-commands}{end-figure-commands}

  % later...
  \begin{figure}
     blah blah
  \end{figure}

All of the content in the figure environment ("blah blah" in this case) is 
placed
between the start-figure-commands and the end-figure-commands and then TeX sets 
to
work on it all.

So the lrbox and minipage environments are opened in the start-figure-commands, 
the
"blah blah" contents are placed inside, and then they're closed immediately in 
the
end-figure-commands.

Hope that clears things up a bit.  It's definitely a little confusing-looking 
at the
moment since there's so much code jammed in there.

Good catch on the no-caption bug.  I'll get that fixed.

Original comment by godbyk@gmail.com on 15 Apr 2009 at 10:17

GoogleCodeExporter commented 9 years ago
Thanks for explaining the environment command a little. It is much easier to 
understand the sty file now. 

The no caption bug is still present, just more subtle now. I attached two pdfs 
of one page as an example. It 
seems that the caption still get some space reserved even when there is no 
caption. In a figure* that gives some 
unexpected results.

Original comment by andytho...@web.de on 19 Apr 2009 at 9:34

Attachments:

GoogleCodeExporter commented 9 years ago
oops, forgot the code.

\begin{figure*}
    \includegraphics[width=\textwidth]{papers/jap2009V105S073701-page1.pdf}
\end{figure*}

I basically used figure* to attach some publications in the appendix. 

Original comment by andytho...@web.de on 19 Apr 2009 at 9:37

GoogleCodeExporter commented 9 years ago
I tracked it down to the point that it works in the sample-handout.tex with 
\linewidth instead of \textwidth. 
Changing it in my file did the job as well. 

Now, I would rather say it is wrong use by myself, since the example file 
explicitly uses \linewidth.

[width=\linewidth] seems to work for marginfigure, figure, and figure*. I guess 
one should use that.

Original comment by andytho...@web.de on 19 Apr 2009 at 9:57

GoogleCodeExporter commented 9 years ago
Does the current no-caption code work as you expect it to, then?

Yeah, I'd recommend using \linewidth in all the environments, if you want the 
graphic
to take up the full width of that environment.  \linewidth refers to the line 
width
of the current environment, \textwidth refers always to the width of the main 
body,
\marginparwidth refers always to the width of the sidenote space.  So if you use
\includegraphics[width=\linewidth]{mypic}, then it'll get resized automatically 
if
you switch from figure to marginfigure to figure*.

Original comment by godbyk@gmail.com on 19 Apr 2009 at 10:03

GoogleCodeExporter commented 9 years ago
Yes, the no-caption code does work as I expect it. 

Original comment by andytho...@web.de on 19 Apr 2009 at 10:15

GoogleCodeExporter commented 9 years ago
Marking as FIXED.

Original comment by godbyk@gmail.com on 19 Apr 2009 at 11:47