emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Forcing line breaks in src (monospace) examples


From: Peter Davis
Subject: Re: [O] Forcing line breaks in src (monospace) examples
Date: Sun, 14 Jun 2015 11:53:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.51 (darwin)

Robert Klein <address@hidden> writes:

> Hi,
>
> On Sun, 14 Jun 2015 10:51:59 -0400
> Peter Davis <address@hidden> wrote:
>
>> 
>> 
>> On 6/14/15 10:44 AM, Peter Davis wrote:
>> > #+BEGIN_LaTeX
>> > curl -v -X GET -H "Authorization:...\",   \"access_token\": \"..." 
>> > "http://blah.blah.blah.com/v1/REST_API_STUFF/...";
>> > #+END_LaTeX
>> Sorry, that should be:
>> 
>> 
>> #+BEGIN_LaTeX
>> \tt{curl -v -X GET -H "Authorization:...\",   \"access_token\":
>> \"..." "http://blah.blah.blah.com/v1/REST_API_STUFF/..."}
>> #+END_LaTeX
>> 
>> 
>
>
> This will do the job:
>
> #+LaTeX_HEADER: \usepackage{xcolor}
> #+LaTeX_HEADER: \lstset{
> #+LaTeX_HEADER:     basicstyle=\ttfamily,
> #+LaTeX_HEADER:     breaklines=true,
> #+LaTeX_HEADER:     prebreak=\mbox{\ensuremath{\triangleright}},
> #+LaTeX_HEADER:     columns=fullflexible,
> #+LaTeX_HEADER:     keepspaces=true
> #+LaTeX_HEADER: }
>
>
> #+begin_src sh
>   curl -v -X GET -H "Authorization:...",   "access_token": "..."
>   "http://blah.blah.blah.com/v1/REST_API_STUFF/...";
> #+end_src
>
>
> Note I use a `sh' source block, not `curl' and not a LaTeX block.  So
> you'll also be able to publish to HTML and someone using the document
> can copy and past the command to her/his command line.
>
> The `prebreak' setting for some reasons needs some kind of box or the
> LaTeX process croaks.
>
> Also nice, I got this from
> tex.stackexchange.com/questions/116534/lstlisting-line-wrapping is
> this postbreak setting for lstlistings (needs the xcolor package above):
>
> postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}},
>

Thanks, Robert. This looks very promising, but it doesn't seem to work
for me. Here's my sample document:

------ cut here ------
#+LaTeX_HEADER: \usepackage{xcolor}
#+LaTeX_HEADER: \lstset{
#+LaTeX_HEADER:     basicstyle=\ttfamily,
#+LaTeX_HEADER:     breaklines=true,
#+LaTeX_HEADER:     prebreak=\mbox{\ensuremath{\triangleright}},
#+LaTeX_HEADER:     
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}},
#+LaTeX_HEADER:     columns=fullflexible,
#+LaTeX_HEADER:     keepspaces=true
#+LaTeX_HEADER: }
#+LaTeX_CLASS_OPTIONS: [article,letterpaper,times,12pt,listings-bw,microtype]
#+author: Peter Davis
#+title: Hello, Test Document

#+BEGIN_SRC sh
curl -v -X GET -H "Authorization:...\",   \"access_token\": \"..." 
"http://blah.blah.blah.com/v1/blahblahblah/...";
#+END_SRC
------ cut here ------

Thank you!

-pd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]