From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Davis Subject: Re: Forcing line breaks in src (monospace) examples Date: Sun, 14 Jun 2015 13:01:28 -0400 Message-ID: <557DB368.4050301@pfdstudio.com> References: <557D936B.3050501@pfdstudio.com> <557D950F.7030009@pfdstudio.com> <20150614173637.7633a81e@zotac> <6sw6c7616qnv65.fsf@dhcp-10-82-66-30.hmco.com> <20150614181100.11ec3d7a@zotac> <6sw6c71thentsl.fsf@dhcp-10-82-66-30.hmco.com> <20150614183836.5db13a41@zotac> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4BHp-0000KA-Tq for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 13:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4BHl-0002xV-Ad for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 13:01:33 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:49802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4BHl-0002v4-65 for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 13:01:29 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 9043120ABF for ; Sun, 14 Jun 2015 13:01:28 -0400 (EDT) In-Reply-To: <20150614183836.5db13a41@zotac> 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: emacs-orgmode@gnu.org Ah! I wound up adding this: #+LaTeX_HEADER: \renewenvironment{verbatim}{\begin{lstlisting}}{\end{lstlisting}\ignorespacesafterend} but your approach is cleaner. Thanks! -pd On 6/14/15 12:38 PM, Robert Klein wrote: > Hi Peter, > > hmm, yes, you have to tell org to use the listings package. > > It works when I use this one-line .emacs: > > (setq org-latex-listings t) > > > and your example file plus `#+LaTeX_HEADER: \usepackage{listings}': > > --- snip --- > #+LaTeX_HEADER: \usepackage{listings} > #+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}\$ > #+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 > --- snip --- > > Sorry for the confusion. > > Best regards > Robert > > > > > On Sun, 14 Jun 2015 12:23:06 -0400 > Peter Davis wrote: > >> Hi, Robert, >> >> That helps (it gets rid of the extra first page), but I'm still not >> getting the line to wrap. >> >> Thanks, >> -pd >> >> >> Robert Klein writes: >> >>> Hi Peter, >>> >>> sorry, I have >>> >>> (add-to-list 'org-latex-packages-alist '("" "listingsutf8")) >>> >>> in my .emacs (utf8 version of listings so I can use umlauts). >>> >>> >>> You can also simply put >>> >>> #+LaTeX_HEADER: \usepackage{listings} >>> >>> to the top of the file. >>> >>> >>> (PS: you won't need the xcolor package unless you want your triangle >>> e.g. in red...) >>> >>> Best regards >>> Robert >>> >>> >>> On Sun, 14 Jun 2015 11:53:22 -0400 >>> Peter Davis wrote: >>> >>>> Robert Klein writes: >>>> >>>>> Hi, >>>>> >>>>> On Sun, 14 Jun 2015 10:51:59 -0400 >>>>> Peter Davis 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 >>>> >>>> >>>> >