From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thomas S. Dye" Subject: Re: org-caption-shortn Date: Thu, 17 Feb 2011 15:32:26 -1000 Message-ID: <303E3306-814B-4451-95F3-A34E56DAA740@tsdye.com> References: <461D5ABC-6BC6-4A8E-9BC1-218F64EE97C6@tsdye.com> <6E184DC8-D9D2-4A1F-9D1B-77F0FE5AE4F6@tsdye.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: multipart/mixed; boundary=Apple-Mail-24--289517205 Return-path: Received: from [140.186.70.92] (port=46013 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqFCz-0000MF-69 for emacs-orgmode@gnu.org; Thu, 17 Feb 2011 20:32:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqFCy-0001fS-3c for emacs-orgmode@gnu.org; Thu, 17 Feb 2011 20:32:33 -0500 Received: from oproxy2-pub.bluehost.com ([67.222.39.60]:38050) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PqFCx-0001fH-RS for emacs-orgmode@gnu.org; Thu, 17 Feb 2011 20:32:32 -0500 In-Reply-To: <6E184DC8-D9D2-4A1F-9D1B-77F0FE5AE4F6@tsdye.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S. Dye" Cc: Org Mode --Apple-Mail-24--289517205 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Aloha all, Replying to myself again. I have only the faintest idea what I'm doing, but this patch appears to take care of the problem described earlier, where the optional argument to the LaTeX caption command was recycled if not replaced by a new optional argument. The captions exported to LaTeX now can include or not the optional argument. My org-mode document now exports both captions and entries in the list of figures correctly. All the best, Tom --Apple-Mail-24--289517205 Content-Disposition: attachment; filename=0001-lisp-org-exp.el-Set-shortn-nil-before-parsing-a-capt.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-lisp-org-exp.el-Set-shortn-nil-before-parsing-a-capt.patch" Content-Transfer-Encoding: quoted-printable =46rom=20ccf83187afe11175ed60911e657945d29a7b989c=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Tom=20Dye=20=0ADate:=20Thu,=20= 17=20Feb=202011=2015:23:29=20-1000=0ASubject:=20[PATCH]=20*=20= lisp/org-exp.el:=20Set=20shortn=20nil=20before=20parsing=20a=20caption=0A= =0A---=0A=20lisp/org-exp.el=20|=20=20=20=201=20+=0A=201=20files=20= changed,=201=20insertions(+),=200=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/org-exp.el=20b/lisp/org-exp.el=0Aindex=200e525e1..9f0e378=20= 100644=0A---=20a/lisp/org-exp.el=0A+++=20b/lisp/org-exp.el=0A@@=20= -1721,6=20+1721,7=20@@=20table=20line.=20=20If=20it=20is=20a=20link,=20= add=20it=20to=20the=20line=20containing=20the=20link."=0A=20=20=20=20=20=20= =20=20;;=20there=20is=20a=20caption=0A=20=20=20=20=20=20=20=20= ((match-end=201)=0A=20=09(progn=0A+=09=20=20(setq=20shortn=20nil)=0A=20=09= =20=20(setq=20cap=20(concat=20cap=20(if=20cap=20"=20"=20"")=20(org-trim=20= (match-string=201))))=0A=20=09=20=20(when=20(string-match=20= "\\[\\(.*\\)\\]{\\(.*\\)}"=20cap)=0A=20=09=20=20=20=20(setq=20shortn=20= (match-string=201=20cap)=0A--=20=0A1.7.1=0A=0A= --Apple-Mail-24--289517205 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Feb 17, 2011, at 6:42 AM, Thomas S. Dye wrote: > Aloha all, > > First, apologies for my rudimentary programming skills. The > attached patch partially answers the query I posed earlier: the > shortn argument was ignored except for the wrapfigure environment. > The attached patch makes other environments aware of shortn. > > This works, sort of. If all the #+CAPTION: lines are of this form # > +CAPTION: [shortn]{caption}, then all goes well. If one caption of > this form is followed by others of this form #+CAPTION: caption, > then the list of figures contains repeated entries of shortn. I > suspect there is code somewhere that clears a variable. I can try > to look for it, but I have to tell you that the lisp code to org- > mode looks like magic spells to my untrained eye. > > All the best, > Tom > > <0001-lisp-org-latex.el-Enable-optional-argument-to-LaTeX-.patch> > > > On Feb 16, 2011, at 6:23 PM, Thomas S. Dye wrote: > >> Aloha all, >> >> I stumbled across code in org-exp.el and org-latex.el that appears >> to my untrained eye to be designed to parse the optional argument >> to the LaTeX \caption command. >> >> This bit in org-exp.el appears to parse out the optional command: >> >> (when (string-match "\\[\\(.*\\)\\]{\\(.*\\)}" cap) >> (setq shortn (match-string 1 cap) >> cap (match-string 2 cap))) >> >> Then it is easy to find code in org-latex.el by searching for >> 'shortn' that looks like it writes out the full command to the .tex >> file. >> >> I can't find documentation for this, though. It looks (to my >> untrained eye) like it should be possible to write something like: >> >> #+CAPTION: [short]{long} >> >> and get >> >> \caption[short]{long} in the .tex file. >> >> But this doesn't work for me. The [short] part doesn't make it >> into the .tex file. >> >> I don't know enough lisp to figure this out in a reasonable amount >> of time, so have come to the list to ask if anyone familiar with >> the code knows whether this should work or not, and if it should >> work, how to markup the org file. >> >> All the best, >> Tom >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > --Apple-Mail-24--289517205 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Apple-Mail-24--289517205--