From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80353 Path: news.gmane.org!not-for-mail From: Marco Patzer Newsgroups: gmane.comp.tex.context Subject: Re: Figure captions in margin Date: Sun, 20 Jan 2013 17:01:57 +0100 Message-ID: <20130120160157.GO29592@homerow> References: <50FC09DB.40207@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0676162757==" X-Trace: ger.gmane.org 1358697732 3283 80.91.229.3 (20 Jan 2013 16:02:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2013 16:02:12 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Jan 20 17:02:30 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TwxLp-0001MS-0O for gctc-ntg-context-518@m.gmane.org; Sun, 20 Jan 2013 17:02:29 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 871C4101EA; Sun, 20 Jan 2013 17:02:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id h8bO0q53Uff3; Sun, 20 Jan 2013 17:02:09 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 8044D101E5; Sun, 20 Jan 2013 17:02:09 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 50781101E5 for ; Sun, 20 Jan 2013 17:02:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lYnaT2gdekqx for ; Sun, 20 Jan 2013 17:02:07 +0100 (CET) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 37538101E2 for ; Sun, 20 Jan 2013 17:02:07 +0100 (CET) Original-Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r0KG2462028775 for ; Sun, 20 Jan 2013 17:02:05 +0100 Original-Received: from c.earth.lavabit.com (c.earth.lavabit.com [192.168.111.12]) by karen.lavabit.com (Postfix) with ESMTP id 6CEF211BC3A for ; Sun, 20 Jan 2013 10:02:03 -0600 (CST) Original-Received: from homerow (83.68.239.193) by lavabit.com with ESMTP id MVTVQUQTYEFF for ; Sun, 20 Jan 2013 10:02:03 -0600 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=tdhkGPbVlwKZcq5EGMrq7ZKdghl7HVnXEP5+iIqXbnJR6EcH/rnL5KTOomUrxHmSYQkPgImkYS5ztgN2ZL06rDmJ019mYQTHw77KbFBNSm3GEmkxtaHL5sAhF0JRyn96Yh26t4hrAlu3w5uD6yNTdWdg+oEmBn9kgiaGsT2DieE=; h=Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; Mail-Followup-To: ntg-context@ntg.nl In-Reply-To: <50FC09DB.40207@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.9994 (Score 4.7, tokens from: @@RPTN) X-CanIt-Geo: ip=72.249.41.33; country=US; region=TX; city=Dallas; postalcode=75204; latitude=32.8019; longitude=-96.7883; metrocode=623; areacode=214; http://maps.google.com/maps?q=32.8019,-96.7883&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0VIOg25SC - 0ceebba48ad3 - 20130120 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.220 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:80353 Archived-At: --===============0676162757== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XFI+TFG+M3u0jUjZ" Content-Disposition: inline --XFI+TFG+M3u0jUjZ Content-Type: multipart/mixed; boundary="Y5wfsVCgeKAcINk2" Content-Disposition: inline --Y5wfsVCgeKAcINk2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2013=E2=80=9301=E2=80=9320 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=3Drightmargin,high/low]. >=20 > 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=3D7.5ex) to align the description vertically. 3) The \startplacesmartfigure is not very robust. My notes say =E2=80=9CDo not indent \startplacesmartfigure=E2=80=9D. 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 --Y5wfsVCgeKAcINk2 Content-Type: text/x-tex; charset=us-ascii Content-Disposition: attachment; filename="marginfloat.tex" \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 --Y5wfsVCgeKAcINk2-- --XFI+TFG+M3u0jUjZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJQ/BT1AAoJEPGqVaNSn0iKrPYIAKR8UwqZQUZeTRTqyLHp8GPr jC1TjnlGSoQHCAv30AET4MCVOpgSCOxMEWK4HtsN2jdRScFAZAeBb2GTpsCjINGe hZAnt3dqnxR1Wjotsrhgms4ntdAGhJb1kUW33qniuKbehmYU2dDR6zwYzwOpO3NN z+Mf2nE2D+hEhxLV0wgafYkaSC41uuWGK7ZnzBbkQ9BOfV4TQ9CVP53W75rr1Xvu k5GYGXNBi1F0izDy5Te8B6r1medkiQ/8nRJJbGxENhBykxGOySdhmeq9K9OoM2zd 4G7RS9BJe2O7F3LiISQNgWwr7eKv9NvtepmAMz0gxxqcjRCnqG0PaQ/YbL4JCEE= =ppGt -----END PGP SIGNATURE----- --XFI+TFG+M3u0jUjZ-- --===============0676162757== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============0676162757==--