From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew MacLean Subject: Re: Org Babel blocks exports dollar signs to LaTeX verbatim Date: Fri, 4 Sep 2015 10:00:32 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01634d7e0db0fd051eee011d Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXtQ7-0005cm-1s for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 12:00:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXtQ5-0001Lv-FR for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 12:00:54 -0400 Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]:35214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXtQ5-0001Kn-7K for emacs-orgmode@gnu.org; Fri, 04 Sep 2015 12:00:53 -0400 Received: by obuk4 with SMTP id k4so20351913obu.2 for ; Fri, 04 Sep 2015 09:00:52 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt Cc: emacs-orgmode@gnu.org --089e01634d7e0db0fd051eee011d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Ah, thanks! So it was configuration then... I initially figured it was language-dependant, which was why I tried it in Ruby, since "$" is a valid character in that language... What I didn't anticipate was that the boxes came from intelligent-syntax checking--I figured that it was just some sort of fancy character I was unfamiliar with that needed to be escaped. So, the way I fixed the issue in my Org file was to add the following to override the syntax error checking: #+LATEX_HEADER: \expandafter\def\csname PY@tok@err\endcsname{} It was recommended on that Stack Exchange answer not to do this, but we aren't writing code directly in LaTeX, we're using Org mode..! That means we don't really need error highlighting in our exporting, since that sort of thing is already covered by existing language support. On Fri, Sep 4, 2015 at 5:57 AM, Alan Schmitt wrote: > (Still catching up on orgmode mail =E2=80=A6 sorry if you already found a= way to > address the issue) > > On 2015-08-18 18:13, Matthew MacLean writes: > > > When working with Org Babel source code blocks, if I have a dollar sign > in my > > code and export it to PDF using LaTeX, it appears to parse as an intern= al > > link. (Maybe?) > > > > This is what it looks like: > > Inline image 1 > > That comes from the following source code block: > > > > #+BEGIN_SRC sql :eval no :var id=3D1 > > SELECT * FROM blah > > WHERE id=3D$id > > #+END_SRC > > > > The resulting LaTeX from the source code block is: > > > > \begin{minted}[]{sql} > > SELECT * FROM blah > > WHERE id=3D$id > > \end{minted} > > > > I have verified that SQL is not the only block type to do this by havin= g > a > > Ruby block with nothing except a "$" in it, and got the same result. > > These red boxes often come from signaling a syntax error from pygments, > which I confirmed by putting the code in a test.sql file and running: > > % pygmentize -f latex test.sql > \begin{Verbatim}[commandchars=3D\\\{\}] > \PY{k}{SELECT} \PY{o}{*} \PY{k}{FROM} \PY{n}{blah} > \PY{k}{WHERE} \PY{n}{id}\PY{o}{=3D}\PY{err}{\PYZdl{}}\PY{n}{id} > \end{Verbatim} > > You can see the =E2=80=9C\PY{err}=E2=80=9D that signals a parser error ar= ound the dollar > sign. > > There are some solutions to hide these boxes here: > > http://tex.stackexchange.com/questions/14166/red-box-drawn-around-questio= n-mark-operator-in-minted-erlang-code > > Best, > > Alan > > -- > OpenPGP Key ID : 040D0A3B4ED2E5C7 > Last week athmospheric CO=E2=82=82 average (Updated August 31, 2015, Maun= a Loa > Obs.): > 377.82 ppm > --089e01634d7e0db0fd051eee011d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Ah, thanks! So it was configuration then...

=
I initially figured it was language-dependant, which was why I tried i= t in Ruby, since "$" is a valid character in that language... Wha= t I didn't anticipate was that the boxes came from intelligent-syntax c= hecking--I figured that it was just some sort of fancy character I was unfa= miliar with that needed to be escaped.

So, the way= I fixed the issue in my Org file was to add the following to override the = syntax error checking:

=C2=A0 =C2=A0 #+LATEX_= HEADER: \expandafter\def\csname PY@tok@err\endcsname{}

=
It was recommended on that Stack Exchange answer not to do this,= but we aren't writing code directly in LaTeX, we're using Org mode= ..! That means we don't really need error highlighting in our exporting= , since that sort of thing is already covered by existing language support.=

On Fri, Sep= 4, 2015 at 5:57 AM, Alan Schmitt <alan.schmitt@polytechnique= .org> wrote:
(Still catchin= g up on orgmode mail =E2=80=A6 sorry if you already found a way to
address the issue)

On 2015-08-18 18:13, Matthew MacLean <archenoth@gmail.com> writes:

> When working with Org Babel source code blocks, if I have a dollar sig= n in my
> code and export it to PDF using LaTeX, it appears to parse as an inter= nal
> link. (Maybe?)
>
> This is what it looks like:
> Inline image 1
> That comes from the following source code block:
>
> #+BEGIN_SRC sql :eval no :var id=3D1
> SELECT * FROM blah
> WHERE id=3D$id
> #+END_SRC
>
> The resulting LaTeX from the source code block is:
>
> \begin{minted}[]{sql}
> SELECT * FROM blah
> WHERE id=3D$id
> \end{minted}
>
> I have verified that SQL is not the only block type to do this by havi= ng a
> Ruby block with nothing except a "$" in it, and got the same= result.

These red boxes often come from signaling a syntax error from pygmen= ts,
which I confirmed by putting the code in a test.sql file and running:

% pygmentize -f latex test.sql
\begin{Verbatim}[commandchars=3D\\\{\}]
\PY{k}{SELECT} \PY{o}{*} \PY{k}{FROM} \PY{n}{blah}
\PY{k}{WHERE} \PY{n}{id}\PY{o}{=3D}\PY{err}{\PYZdl{}}\PY{n}{id}
\end{Verbatim}

You can see the =E2=80=9C\PY{err}=E2=80=9D that signals a parser error arou= nd the dollar
sign.

There are some solutions to hide these boxes here:
http://tex.stackexchange.com/questions/14166/red-box-drawn-arou= nd-question-mark-operator-in-minted-erlang-code

Best,

Alan

--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Last week athmospheric CO=E2=82=82 average (Updated August 31, 2015, Mauna = Loa Obs.):
377.82 ppm

--089e01634d7e0db0fd051eee011d--