* Figure captions in margin @ 2013-01-20 15:14 Devendra Ghate 2013-01-20 16:01 ` Marco Patzer 0 siblings, 1 reply; 3+ messages in thread From: Devendra Ghate @ 2013-01-20 15:14 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1: Type: text/plain, Size: 973 bytes --] I am using a layout with wide right margin. For floats that are \textwidth wide, I can place captions in the margin using**\setupcaption[location=rightmargin,high/low]. However, for figures that are (*\textwidth+\marginwidth+\margindistance*) wide, I would like to *place the caption in the margin below the figure*. I have tried spacebefore=\vskip but it doesn't seem to do anything. Another option was to use default caption location (below the figure) and add \hspace before figure placement. None of these work as I am not able to make spacebefore do anything. *MWE* \setuplayout[width=5cm, height=13cm,rightmargin=5cm] \setupexternalfigures[option=empty] \setupfloat[figure][location=inner] % \setupcaption [figure] [width=5cm, location={rightmargin,low}, spacebefore=big] %\setupcaption %[figure] %[width=5cm] \starttext \showframe \placefigure{A small but important caption.}{\externalfigure[cow][width=10cm]} \stoptext [-- Attachment #1.2: Type: text/html, Size: 1463 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Figure captions in margin 2013-01-20 15:14 Figure captions in margin Devendra Ghate @ 2013-01-20 16:01 ` Marco Patzer 2013-01-21 7:49 ` Devendra Ghate 0 siblings, 1 reply; 3+ messages in thread From: Marco Patzer @ 2013-01-20 16:01 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1.1: Type: text/plain, Size: 1098 bytes --] On 2013–01–20 Devendra Ghate wrote: > I am using a layout with wide right margin. For floats that are > \textwidth wide, I can place captions in the margin > using**\setupcaption[location=rightmargin,high/low]. > > However, for figures that are > (*\textwidth+\marginwidth+\margindistance*) wide, I would like to > *place the caption in the margin below the figure*. For a recent project I had the similar requirements. I did not find a proper solution. I attached an example of the code I used. However, it has several issues: 1) Margin floats and texts overlay and need manual adjustment. 2) The baseline of the float description does not match the baseline of the main text (fixed using manual trial and error). I used an ugly hack (toffset=7.5ex) to align the description vertically. 3) The \startplacesmartfigure is not very robust. My notes say “Do not indent \startplacesmartfigure”. I don't recall what the exact issue was. 4) Probably many more that I haven't discovered, yet. Feel free to suggest fixes for the mentioned issues. Marco [-- Attachment #1.1.2: marginfloat.tex --] [-- Type: text/x-tex, Size: 2963 bytes --] \useMPlibrary [dum] \unprotect \setupfloat [figure] [default={top,bottom}] \setupfloat [table] [default={bottom,top}] \definefloat [margintable] [margintables] [table] \definefloat [marginfigure] [marginfigures] [figure] \setupcaptions [width=\marginwidth, prefix=no] \setupcaption [table] [location={outermargin, high}] \setupcaption [figure] [location={outermargin, high}] \setupcaption [marginfigure, margintable] [align=flushleft, location=bottom] \setupcaption [table, figure] [way=bytext] \setupfloat [marginfigure, margintable] [default=margin] \definefloat [widetable] [widetables] [table] \setupfloat [widetable] [location=inner] \definefloat [widefigure] [widefigures] [figure] \setupfloat [widefigure] [location=inner] \defineframed [caption_framed] [frame=off, offset=overlay, location=high, toffset=7.5ex] \starttexdefinition caption_command #1 \caption_framed{#1} \stoptexdefinition \setupcaption [widetable] [location={outermargin, low}, command=\caption_command] \setupcaption [widefigure] [location={outermargin, low}, command=\caption_command] \newtoks\t_smart_figure_args \starttexdefinition startplacesmartfigure [#1] \t_smart_figure_args={#1} \grabbufferdata [smart_figure_buffer] [startplacesmartfigure] [stopplacesmartfigure] \stoptexdefinition \startluacode userdata = userdata or { } function userdata.do_place_smart_figure(width) context.unprotect() if tex.sp(width) <= tex.dimen.rightmarginwidth + tex.sp(".1pt") then context.startplacemarginfigure{tex.toks.t_smart_figure_args} tex.print(buffers.getcontent("smart_figure_buffer")) context.stopplacemarginfigure() else if tex.sp(width) <= tex.dimen.textwidth + tex.sp(".1pt") then context.startplacefigure{tex.toks.t_smart_figure_args} tex.print(buffers.getcontent("smart_figure_buffer")) context.stopplacefigure() else context.startplacewidefigure{tex.toks.t_smart_figure_args} tex.print(buffers.getcontent("smart_figure_buffer")) context.stopplacewidefigure() end end context.protect() end \stopluacode \starttexdefinition stopplacesmartfigure \scratchdimen\hsize \hsize\maxdimen \setbox\scratchbox\vbox{\getbuffer[smart_figure_buffer]} \hsize\scratchdimen \luacode{userdata.do_place_smart_figure("\the\wd\scratchbox")} \stoptexdefinition \protect \starttext \startplacesmartfigure [title=Foo] \externalfigure [dummy] [width=\rightmarginwidth, height=3cm] \stopplacesmartfigure \dorecurse{5}{%% \input knuth\par} \startplacesmartfigure [title=\input ward\par] \externalfigure [dummy] [width=\textwidth, height=8cm] \stopplacesmartfigure \startplacesmartfigure [title=\input ward\par] \externalfigure [dummy] [width=\dimexpr\textwidth+\rightmargintotal\relax, height=3cm] \stopplacesmartfigure \stoptext [-- Attachment #1.2: Digital signature --] [-- Type: application/pgp-signature, Size: 490 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Figure captions in margin 2013-01-20 16:01 ` Marco Patzer @ 2013-01-21 7:49 ` Devendra Ghate 0 siblings, 0 replies; 3+ messages in thread From: Devendra Ghate @ 2013-01-21 7:49 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 1928 bytes --] Hello Marco, Your code goes well beyond what I was looking for. As I am working on a deadline right now, I am just going to use the frame trick to place the caption for wide figures. However, expect to hear from me in future regarding this code. Regards, Devendra On 01/20/2013 09:31 PM, Marco Patzer wrote: > On 2013--01--20 Devendra Ghate wrote: > >> I am using a layout with wide right margin. For floats that are >> \textwidth wide, I can place captions in the margin >> using**\setupcaption[location=rightmargin,high/low]. >> >> However, for figures that are >> (*\textwidth+\marginwidth+\margindistance*) wide, I would like to >> *place the caption in the margin below the figure*. > For a recent project I had the similar requirements. I did not find > a proper solution. I attached an example of the code I used. > However, it has several issues: > > 1) Margin floats and texts overlay and need manual adjustment. > 2) The baseline of the float description does not match the baseline > of the main text (fixed using manual trial and error). I used an > ugly hack (toffset=7.5ex) to align the description vertically. > 3) The \startplacesmartfigure is not very robust. My notes say "Do > not indent \startplacesmartfigure". I don't recall what the exact > issue was. > 4) Probably many more that I haven't discovered, yet. > > Feel free to suggest fixes for the mentioned issues. > > Marco > > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ [-- Attachment #1.2: Type: text/html, Size: 2989 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-21 7:49 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-01-20 15:14 Figure captions in margin Devendra Ghate 2013-01-20 16:01 ` Marco Patzer 2013-01-21 7:49 ` Devendra Ghate
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).