The problem you are encountering is that the latexmath JavaScript is
interpreting those dollar signs as the start of a math expression. That
also explains why it only happens in the html5 output (all the rest of the
backends go through the DocBook toolchain and don't use the latexmath
JavaScript).

The proper way to insert a dollar sign is to use \$. However, if you make
that change in your example, the dollar still isn't rendered. That's
because the syntax highlighter is separating the backslash and the dollar,
so latexmath still sees the dollar sign.

One option is to switch the source highlighter to pygments, which seems to
leave the \$ alone.

A better option may be to hack up the latexmath script to leave listing
blocks alone. You need to look at the JavaScript function AMprocessNodeR.

-Dan


On Thu, Oct 17, 2013 at 8:37 AM, <[email protected]> wrote:

> Hi all,
>
> I am trying to produce some documentation with asciidoc and really
> enjoying the fact that I can take the exact same file and compile it to pdf
> and/or html. However, I am having a problem formatting some code. In
> particular, I cannot get a dollar-sign to show up in the html5 version of a
> code block. I have text like this:
>
> --> Begin my example...
> Create a shell script to run your simple job, +do_a_cccoh_run.sh+:
>
> ifdef::basebackend-docbook[[source,bash]]
> ifdef::basebackend-html[[source,bash]]
> ---------------------------
> #!/bin/sh
> gevgen -n 5 -p 14 -t 1000060120 -e 0,10 --run 100 \
>   -f 'x*exp(-x)' \
>   --seed 2989819 --cross-sections $XSECSPLINEDIR/coh_carbon_splines.xml \
>   --event-generator-list CCCOH
> ---------------------------
> <-- End of my example.
>
> And I compile with this script:
>
> --> My script.
> #!/bin/sh
> DOCNAME=DeveloperManual_v0.1.adoc
> asciidoc $1 -b html5 -a latexmath -a data-uri -a toc2 ${DOCNAME}
> # a2x $1 -a latexmath -f xhtml ${DOCNAME}
> a2x $1 -a latexmath -f pdf ${DOCNAME}
> <-- My script.
>
> You can see from the comment I tried xhtml also. The $1 arg is for cases
> when I want to pass in "-v".
>
> The html version comes out very nicely colored, but with no dollar sign
> before XSECSPLINEDIR. The pdf version is fine.
>
> I also tried a snippet like this:
>
> --> Begin my example
> Compare
>
> [source,perl]
> --------------
> my @tripled = map { $_ * 3 } @numbers;
>
> my @tripled;
> for my $num (@numbers) {
>   push @tripled, $num * 3;
> }
>
> my @tripled;
> for (my $i = 0; $i < scalar @numbers; $i++) {
>   $tripled[$i] = $numbers[$i] * 3;
> }
> --------------
> <--- end my example
>
> with just: asciidoc -b html5 -a latexmath -a data-uri -a toc2 mperl.adoc
>
> The colors are beautiful and all the symbols are rendered except the
> dollar sign. If I compile for pdf:
>
> a2x -f pdf mperl.adoc
>
> everything looks great.
>
> Can anyone offer any hints?
>
> Thanks!
>
> pax
> Gabe
>
>  --
> You received this message because you are subscribed to the Google Groups
> "asciidoc" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/asciidoc.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Dan Allen | http://google.com/profiles/dan.j.allen

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to