emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Escaping to insert comments in exported text
@ 2011-03-27 10:48 Suvayu Ali
  2011-03-27 16:36 ` Thomas S. Dye
  2011-03-28 15:17 ` [PATCH] Prefer matching line beginnings in org-export-latex-special-chars Lawrence Mitchell
  0 siblings, 2 replies; 4+ messages in thread
From: Suvayu Ali @ 2011-03-27 10:48 UTC (permalink / raw)
  To: Org mode mailing list

Hi Orgers,

I wanted to insert comments in the exported tex file for latex export.
Is there an standard way to do that? I found normal '%text' gets
exported as '\%text'. However I can export comments by putting
'%%text', it gets exported as '%\%text'.

Is there any other solutions out there?

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Escaping to insert comments in exported text
  2011-03-27 10:48 Escaping to insert comments in exported text Suvayu Ali
@ 2011-03-27 16:36 ` Thomas S. Dye
  2011-03-27 20:03   ` Suvayu Ali
  2011-03-28 15:17 ` [PATCH] Prefer matching line beginnings in org-export-latex-special-chars Lawrence Mitchell
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2011-03-27 16:36 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Org mode mailing list

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

Aloha Suvayu,

I'd be inclined to use #+LaTeX: %text

Alternatively (and perhaps more robustly with multiline comments) you  
could make certain to \usepackage{verbatim} and then use

#+BEGIN_COMMENT
text
#+END_COMMENT

following the example of block level markup here:
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10_2

hth,
Tom

On Mar 27, 2011, at 12:48 AM, Suvayu Ali wrote:

> Hi Orgers,
>
> I wanted to insert comments in the exported tex file for latex export.
> Is there an standard way to do that? I found normal '%text' gets
> exported as '\%text'. However I can export comments by putting
> '%%text', it gets exported as '%\%text'.
>
> Is there any other solutions out there?
>
> -- 
> Suvayu
>
> Open source is the future. It sets us free.
>


[-- Attachment #2: Type: text/html, Size: 1380 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Escaping to insert comments in exported text
  2011-03-27 16:36 ` Thomas S. Dye
@ 2011-03-27 20:03   ` Suvayu Ali
  0 siblings, 0 replies; 4+ messages in thread
From: Suvayu Ali @ 2011-03-27 20:03 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org mode mailing list

Hi Tom,

On Sun, 27 Mar 2011 06:36:18 -1000
"Thomas S. Dye" <tsd@tsdye.com> wrote:

> Aloha Suvayu,
> 
> I'd be inclined to use #+LaTeX: %text
> 
> Alternatively (and perhaps more robustly with multiline comments)
> you could make certain to \usepackage{verbatim} and then use
> 
> #+BEGIN_COMMENT
> text
> #+END_COMMENT
> 
> following the example of block level markup here:
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10_2
> 

Both of those are much cleaner solutions! Thanks a lot. :)

> hth,
> Tom
> 
> On Mar 27, 2011, at 12:48 AM, Suvayu Ali wrote:
> 
> > Hi Orgers,
> >
> > I wanted to insert comments in the exported tex file for latex
> > export. Is there an standard way to do that? I found normal '%text'
> > gets exported as '\%text'. However I can export comments by putting
> > '%%text', it gets exported as '%\%text'.
> >
> > Is there any other solutions out there?
> >
> > -- 
> > Suvayu
> >
> > Open source is the future. It sets us free.
> >
> 



-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Prefer matching line beginnings in org-export-latex-special-chars
  2011-03-27 10:48 Escaping to insert comments in exported text Suvayu Ali
  2011-03-27 16:36 ` Thomas S. Dye
@ 2011-03-28 15:17 ` Lawrence Mitchell
  1 sibling, 0 replies; 4+ messages in thread
From: Lawrence Mitchell @ 2011-03-28 15:17 UTC (permalink / raw)
  To: emacs-orgmode

* lisp/org-latex.el (org-export-latex-special-chars): Fix regexp for
`single' special characters and ellipsis.

Repeated special characters are exported differently depending on
their position in the buffer.  A "&&" string at the start of a line is
exported as "&\&" whereas in the middle of a line you get "\&\&".  The
former is incorrect.  Fix this by matching the beginning of a line
before a character.  While we're at it, amalgamate the regexps for the
different special characters.
---

Suvayu Ali wrote:
> Hi Orgers,

> I wanted to insert comments in the exported tex file for latex export.
> Is there an standard way to do that? I found normal '%text' gets
> exported as '\%text'. However I can export comments by putting
> '%%text', it gets exported as '%\%text'.

Although this feels like a potentially useful feature, I believe
it is a bug.  Doubled special characters are exported differently
depending on where they are on a line:

&& foo

=> &\& foo

whereas

foo &&

=> foo \&\&

This is because the regexp for finding special characters prefers
matching a character over the start of a line \\(.\\|^\\)\\(&\\)
will set (match-string 1) to & and (match-string 2) to & if &&
occurs at the start of a line, although the intention is that
(match-string 1) should be the empty line-start string and
(match-string 2) the first ampersand.  We can fix this by
changing the regexp to \\(^\\|.\\)\\(&\\) as in this patch.

Cheers,
Lawrence

 lisp/org-latex.el |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 605795c..30f7b4a 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1684,13 +1684,7 @@ See the `org-export-latex.el' code for a complete conversion table."
 	  "\\(\\(\\\\?\\$\\)\\)"
 	  "\\([a-zA-Z0-9()]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-zA-Z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-zA-Z0-9]+}\\|([a-zA-Z0-9]+)\\)"
 	  "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|\\([&#%{}\"]\\|[a-zA-Z][a-zA-Z0-9]*\\)\\)"
-	  "\\(.\\|^\\)\\(&\\)"
-	  "\\(.\\|^\\)\\(#\\)"
-	  "\\(.\\|^\\)\\(%\\)"
-	  "\\(.\\|^\\)\\({\\)"
-	  "\\(.\\|^\\)\\(}\\)"
-	  "\\(.\\|^\\)\\(~\\)"
-	  "\\(.\\|^\\)\\(\\.\\.\\.\\)"
+	  "\\(^\\|.\\)\\([&#%{}~]\\|\\.\\.\\.\\)"
 	  ;; (?\< . "\\textless{}")
 	  ;; (?\> . "\\textgreater{}")
 	  )))
-- 
1.7.4.rc2.18.gb20e9

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-28 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-27 10:48 Escaping to insert comments in exported text Suvayu Ali
2011-03-27 16:36 ` Thomas S. Dye
2011-03-27 20:03   ` Suvayu Ali
2011-03-28 15:17 ` [PATCH] Prefer matching line beginnings in org-export-latex-special-chars Lawrence Mitchell

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).