Re: [O] macro expansion in #+begin_latex
Thank you for the reply. But I don't think it's a good idea. For example: what can I do if want to put a text like the title of my file in the latex header? is there an other way? I know I can use the \@title function of latex, it works. but I need it also for email, date, etc.. macro would be exactly what I want, but maybe someone has thought something better! Thanks again! Wero 2015-06-13 18:58 GMT+02:00, Nicolas Goaziou : > Hello, > > wero_sacero writes: > >> hi, is there anybody that know why in the lastest version of org-mode >> exporting in latex, the macro like {{{title}}} is not expanded if it >> is put in a begin_latex? >> >> In version 7.9... it was working, and I think it should work also now. >> >> Can anyone explain me if it is a non-feature or a bug? > > It is a non-feature. Macro are not allowed in raw or verbatim > environments. > > Regards, > > -- > Nicolas Goaziou >
Re: [O] macro expansion in #+begin_latex
Hi, On Sun, 14 Jun 2015 11:14:13 +0200 wero_sacero wrote: > Thank you for the reply. > > But I don't think it's a good idea. For example: what can I do if want > to put a text like the title of my file in the latex header? is there > an other way? > > I know I can use the \@title function of latex, it works. but I need > it also for email, date, etc.. macro would be exactly what I want, but > maybe someone has thought something better! > I have a set-up to be able to use title, author etc. in LaTeX blocks. Every one of those documents has a (filled out) header like: #+TITLE: #+AUTHOR: Robert Klein #+EMAIL: rokl...@roklein.de #+KEYWORDS: #+DESCRIPTION: #+LaTeX_HEADER: \newcommand{\mySubtitle}{} #+LaTeX_HEADER: \newcommand{\myProducer}{org-mode / pdflatex} Further down I #include a largish file with my standard settings which has the following in it: #+name: docinfo #+begin_src elisp :exports none (let ((props (org-export-get-environment))) (concat "#+LaTeX_HEADER: \\newcommand{\\myTitle}{" (org-element-interpret-data (plist-get props :title)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myAuthor}{" (org-element-interpret-data (plist-get props :author)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myDate}{" (org-element-interpret-data (plist-get props :date)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myCreator}{" (org-element-interpret-data (plist-get props :creator)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myKeywords}{" (org-element-interpret-data (plist-get props :keywords)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\mySubject}{" (org-element-interpret-data (plist-get props :description)) "}\n")) #+end_src #+CALL: docinfo() :exports results :results raw So, further down I can use all those \myTitle etc. commands in LaTeX, e.g.: #+LaTeX_HEADER: % Hyperref PDF Info #+LaTeX_HEADER: \hypersetup{ #+LaTeX_HEADER: pdfinfo={ #+LaTeX_HEADER: Author={\myAuthor}, #+LaTeX_HEADER: Title={\myTitle}, #+LaTeX_HEADER: Subject={\mySubject}, #+LaTeX_HEADER: Keywords={\myKeywords}, #+LaTeX_HEADER: Creator={\myCreator}, #+LaTeX_HEADER: Producer={\myProducer} #+LaTeX_HEADER: }} I also use document-wide properties for data org doesn't handle, e.g. # note: classify as `open access', `internal', `confidential' #+Property: documenttype form sheet #+Property: classification open access though I don't use it in a LaTeX block but in a elisp block w/ org output: #+name: dochead #+header: :var trustlevel=(org-entry-get nil "classification" t) #+header: :var doctype=(org-entry-get nil "documenttype" t) #+begin_src elisp :exports none :results value raw (let ((props (org-export-get-environment))) (concat "#+ATTR_HTML: :rules all\n" "#+ATTR_LATEX: :environment tabu :align ll|ll :booktabs t :width \\textwidth\n" "| Document Type: | " doctype " | Classification: | " trustlevel " |\n" "| Document Title: | " (org-element-interpret-data (plist-get props :title)) " | Author: | " (org-element-interpret-data (plist-get props :author)) " |\n")) #+end_src #+Call: dochead() :exports results :results raw I use this code to generate output intended for both HTML and LaTeX, so I can't use the \myXXX commands above (and, I'm creating org code here to be exported in the course of the current export). I won't claim this is `something better' than using {{{title}}} or so, but once I had the set-up working I'm happy with it. Best regards Robert > Thanks again! > > Wero > > 2015-06-13 18:58 GMT+02:00, Nicolas Goaziou : > > Hello, > > > > wero_sacero writes: > > > >> hi, is there anybody that know why in the lastest version of > >> org-mode exporting in latex, the macro like {{{title}}} is not > >> expanded if it is put in a begin_latex? > >> > >> In version 7.9... it was working, and I think it should work also > >> now. > >> > >> Can anyone explain me if it is a non-feature or a bug? > > > > It is a non-feature. Macro are not allowed in raw or verbatim > > environments. > > > > Regards, > > > > -- > > Nicolas Goaziou > > >
Re: [O] macro expansion in #+begin_latex
wero_sacero writes: > But I don't think it's a good idea. For example: what can I do if want > to put a text like the title of my file in the latex header? is there > an other way? How about org-latex-title-command? Title is accessible via "%t" (Org 8.3). Rasmus -- This message is brought to you by the department of redundant departments
Re: [O] Possible cache problems
Suvayu Ali writes: > I was trying to edit the attr_latex line for the following table: > > #+attr_latex: > | year | 2012 | 2018 | 2022 | 2028 | 2035 | > | γ(°) |7 |4 | 1.3 | 0.9 | 0.6 | Fixed in 182ff104b77d1c4cd03a2749472d9da0c7733116. Thank you. This change requires a modification to `element-check-cache' function I sent you earlier, if you plan to use it again: --8<---cut here---start->8--- (defun element-check-cache (&rest ignore) (when (org-element--cache-active-p) (save-match-data (let ((cache (copy-tree org-element--cache t)) (requests (copy-tree org-element--cache-sync-requests t)) (buffer-contents (org-with-wide-buffer (buffer-string))) (translations (make-hash-table :test #'eq)) (structures (make-hash-table :test #'eq)) (keys (make-hash-table :test #'eq))) ;; Fix parents. (loop for key in (avl-tree-flatten org-element--cache) for value in (avl-tree-flatten cache) do (let ((struct (and (memq (org-element-type key) '(plain-list item)) (gethash (org-element-property :structure key) structures 'missing (progn (puthash key value translations) (let ((k (gethash key org-element--cache-sync-keys))) (when k (puthash value k keys))) (puthash key (org-element-put-property value :parent (gethash (org-element-property :parent key) translations)) translations) (when (eq struct 'missing) (setq struct (puthash (org-element-property :structure key) (org-element-property :structure value) structures))) (when struct (puthash key (org-element-put-property value :structure struct) translations) ;; Fix requests. (loop for original in org-element--cache-sync-requests for copy in requests do (aset copy 4 (gethash (aref original 4) translations))) (with-temp-buffer (let ((org-element-use-cache nil)) (insert buffer-contents)) (let ((org-inhibit-startup t)) (org-mode)) (setq org-element--cache cache org-element--cache-sync-requests requests org-element--cache-sync-keys keys) (org-element--cache-sync (current-buffer) (point-max)) (let ((seen '())) (avl-tree-mapc (lambda (element) (let ((beg (org-element-property :begin element)) (type (org-element-type element))) (let ((real (let (org-element-use-cache) (goto-char (if (memq type '(item table-row)) (1+ beg) beg)) (org-element-at-point (cond ((member real seen) (message "==\nWARNING. Two entries for the same element\n\n %s" element)) ((not (equal real element)) (message "==\nWARNING. Corrupted element (%s) at %d\n\nReal:\ %s\n\nCached: %s\n\nLast request: %s" (org-element-type element) beg real element (car requests))) (t (push real seen)) org-element--cache)))--8<---cut here---end--->8--- Regards,
[O] Trouble passing variables into shell blocks on windows
I'm having difficulties passing org variables into shell source blocks. This is using Windows 7 and Cygwin with bash shell. For instance, the following #+BEGIN_SRC sh :var x="." ls $x #+END_SRC fails with the error message (as displayed in emacs) ls: cannot access .^M^M : No such file or directory As far as I can see, the first ^M stems from org-babel-sh-var-quote-fmt, and the second from org-babel-expand-body:generic, but I haven't been able to figure out a solution. Any suggestions?
[O] Forcing line breaks in src (monospace) examples
I'm writing a document which includes several example commands, which I've wrapped in #+BEGIN_SRC/#+END_SRC. In LaTeX/PDF export, these come out in Courier, as I hoped, but they run off the right edge of the page. For example: #+BEGIN_SRC curl curl -v -X GET -H "Authorization:...\", \"access_token\": \"..." "http://blah.blah.blah.com/v1/REST_API_STUFF/..."; #+END_SRC Years ago, someone on a TeX mailing list offered some code to force line breaking in \tt{...} code, with a \triangleright at the right margin to show the line overflowed. I think this was all it took: % Define obj {\catcode`\_=13\gdef_{{\tt\char`\_}% \discretionary{\rlap{$\triangleright$}}{\llap{$\triangleright$}}{}}} \def\obj{\bgroup\catcode`\_=13\hyphenpenalty=1\relax\sf\sc\endobj} \def\endobj#1{#1\egroup} However, I'm not enough of a TeX wiz to know how to make this work with org-mode, or even if I can. I tried replacing the above with: #+BEGIN_LaTeX curl -v -X GET -H "Authorization:...\", \"access_token\": \"..." "http://blah.blah.blah.com/v1/REST_API_STUFF/..."; #+END_LaTeX But (apart from the need to quote the backslashes, etc.), this didn't seem to do what I wanted. Any suggestions on how to force line breaks? Thank you! -pd
Re: [O] Forcing line breaks in src (monospace) examples
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
Re: [O] Forcing line breaks in src (monospace) examples
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}}, Best regards Robert
Re: [O] Forcing line breaks in src (monospace) examples
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
Re: [O] Forcing line breaks in src (monospace) examples
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 > > >
Re: [O] Forcing line breaks in src (monospace) examples
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 >> >> >>
Re: [O] Forcing line breaks in src (monospace) examples
FWIW, here's the tex generated from my current test: % Created 2015-06-14 Sun 12:33 \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} \usepackage{longtable} \usepackage{float} \usepackage{wrapfig} \usepackage{rotating} \usepackage[normalem]{ulem} \usepackage{amsmath} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} \usepackage{amssymb} \usepackage{hyperref} \tolerance=1000 \usepackage{listingsutf8} \usepackage{listings} \usepackage{xcolor} \lstset{ basicstyle=\ttfamily, breaklines=true, prebreak=\mbox{\ensuremath{\color{red}\hookleftarrow}}, postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}}, columns=fullflexible, keepspaces=true } \author{Peter Davis} \date{\today} \title{wraptest} \hypersetup{ pdfkeywords={}, pdfsubject={}, pdfcreator={Emacs 24.5.1 (Org mode 8.2.10)}} \begin{document} \maketitle \setcounter{tocdepth}{0} \tableofcontents \begin{verbatim} curl -v -X GET -H "Authorization:...\", \"access_token\": \"..." "http://sandbox.api.hmhco.com/v1/staffSectionAssociations/..."; \end{verbatim} % Emacs 24.5.1 (Org mode 8.2.10) \end{document}
Re: [O] Forcing line breaks in src (monospace) examples
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 > >> > >> > >> >
Re: [O] Forcing line breaks in src (monospace) examples
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
Re: [O] macro expansion in #+begin_latex
On Sun, 14 Jun 2015, wero_sacero wrote: Thank you for the reply. But I don't think it's a good idea. For example: what can I do if want to put a text like the title of my file in the latex header? is there an other way? In addition to the suggestions you already have, you can construct the `#+TITLE:' line like this: #+header: :var bfn=(buffer-file-name) #+BEGIN_SRC emacs-lisp :exports results :results value raw (concat "#+TITLE: FileName: " bfn) #+END_SRC The `(buffer-file-name)' can be altered to use any function that returns suitable text or be a call to another src block. HTH, Chuck
[O] clocktables output in hours and minutes only
Still on about clocktables, how can I have the time output show just in "hours.minutes" and not in "days.hours.minutes" please? Thanks Sharon. -- A taste of linux = http://www.sharons.org.uk TGmeds = http://www.tgmeds.org.uk Debian 8.0, fluxbox 1.3.7, emacs 24.5.50.1 signature.asc Description: PGP signature
[O] [PATCH] org-contacts.el: Catch 'nextfile in org-contacts-db
Hi, This is a small patch to catch the 'nextfile thrown by `org-check-agenda-file' in `org-contacts-db'. I don't know how to fix the TODO in the comment myself, sorry. At least, with the patch, the execution doesn't abort anymore. Regards, -- Philippe Crama ===File c:/msys64/tmp/org-mode/0001-org-contacts.el-Catch-nextfile-in-org-contacts-db.patch=== From 6f9679f2118fa8990386a0ed27a34d329cfc579f Mon Sep 17 00:00:00 2001 From: "U-mathilde\\philippe" Date: Wed, 10 Jun 2015 11:05:47 +0200 Subject: [PATCH] org-contacts.el: Catch 'nextfile in org-contacts-db * org-contacts.el (org-contacts-db): Catch 'nextfile in org-contacts-db (org-contacts-db): when a file in the list returned by the `org-contacts-files' function doesn't exist and the user selects the option to attempt to remove it from the `org-agenda-files' list, 'nextfile is thrown. Catch it and skip processing that file instead of failing. TINYCHANGE --- contrib/lisp/org-contacts.el | 41 +++-- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index bc07fc1..edc09fe 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -261,16 +261,37 @@ to dead or no buffer." (make-progress-reporter "Updating Org Contacts Database..." 0 (length org-contacts-files))) (i 0)) (dolist (file (org-contacts-files)) - (org-check-agenda-file file) - (with-current-buffer (org-get-agenda-file-buffer file) - (unless (eq major-mode 'org-mode) - (error "File %s is not in `org-mode'" file)) - (setf result - (append result - (org-scan-tags - 'org-contacts-at-point - contacts-matcher - todo-only + (if (catch 'nextfile +;; if file doesn't exist and the user agrees to removing it +;; from org-agendas-list, 'nextfile is thrown. Catch it here +;; and skip processing the file. +;; +;; TODO: suppose that the user has set an org-contacts-files +;; list that contains an element that doesn't exist in the +;; file system: in that case, the org-agenda-files list could +;; be updated (and saved to the customizations of the user) if +;; it contained the same file even though the org-agenda-files +;; list wasn't actually used. I don't think it is normal that +;; org-contacts updates org-agenda-files in this case, but +;; short of duplicating org-check-agenda-files and +;; org-remove-files, I don't know how to avoid it. +;; +;; A side effect of the TODO is that the faulty +;; org-contacts-files list never gets updated and thus the +;; user is always queried about the missing files when +;; org-contacts-db-need-update-p returns true. +(org-check-agenda-file file)) + (message "Skipped %s removed from org-agenda-files list." + (abbreviate-file-name file)) + (with-current-buffer (org-get-agenda-file-buffer file) + (unless (eq major-mode 'org-mode) + (error "File %s is not in `org-mode'" file)) + (setf result + (append result + (org-scan-tags +'org-contacts-at-point +contacts-matcher +todo-only) (progress-reporter-update progress-reporter (setq i (1+ i (setf org-contacts-db result org-contacts-last-update (current-time)) -- 2.3.5
Re: [O] Add LaTeX to SVG support to org-mode
Hello, Adam Sneller wrote: > Out of the box, emacs supports two methods for rendering LaTeX > previews in orgmode: dvipng and imagemagick. I want to add a third > method, using dvisvgm. I have modified the org.el file to add > org-create-formula-image-with-dvisvg. To propose and discuss changes, please send a patch, not the entire source file. You can find more information at http://orgmode.org/worg/org-contribute.html. -- Kyle
Re: [O] Add LaTeX to SVG support to org-mode
Hello, Adam Sneller writes: > Out of the box, emacs supports two methods for rendering LaTeX > previews in orgmode: dvipng and imagemagick. I want to add a third > method, using dvisvgm. I have modified the org.el file to add > org-create-formula-image-with-dvisvg. Everything seems to work fine, > except that orgmode is unable to find the SVG file and errors "Failed > to create svg file from ...". But the file it is looking for does > exist. > > Any ideas? No, but please refrain from sending the whole "org.el" file, which is 20k lines long. Could you send a diff instead? Also, if you mostly copy paste from `org-create-formula-image-with-dvipng', you may want to merge both functions instead. Regards, -- Nicolas Goaziou
Re: [O] Possible cache problems
On Sun, Jun 14, 2015 at 02:58:25PM +0200, Nicolas Goaziou wrote: > Suvayu Ali writes: > > > I was trying to edit the attr_latex line for the following table: > > > > #+attr_latex: > > | year | 2012 | 2018 | 2022 | 2028 | 2035 | > > | γ(°) |7 |4 | 1.3 | 0.9 | 0.6 | > > Fixed in 182ff104b77d1c4cd03a2749472d9da0c7733116. Thank you. Thanks a lot! > This change requires a modification to `element-check-cache' function > I sent you earlier, if you plan to use it again: Thank you. I'll most definitely use it to debug problems :). Cheers, -- Suvayu Open source is the future. It sets us free.
[O] How do I specify the font attributes in org -> odt exports?
Hi, I require the ox-odt package and I set this variable to export to doc (MS Word 97) format by default: (setq org-odt-preferred-output-format "doc") I have to do this as I need to submit a paper in Word. The export works fine but can someone help me how to write the style ott/xml file so that the export to .doc adheres to the below rules? Title Page (must fit on first page only): Title (bold, centered) – *Times New Roman 18 pt* Author Names (centered) - Times New Roman 16 pt Company/Location/Country/Website (centered) - Times New Roman 14 pt Abstract (left-justified; italicized; not to exceed 150 words) – Times New Roman 12 pt Table of Contents/Figures/Tables*: Header (bold, centered): *Times New Roman 14 pt* Listing (left-justified): Times New Roman 12 pt Body Page and Margins: - One-inch margins; top, bottom, right and left - No headers - Chapter headings (numbered, bold, left justified): *Times New Roman 14 pt* - Chapter body (left justified): Times New Roman 12 pt References (numbered): Times New Roman 11 pt - Use embedded footer, Times New Roman 12 pt (Update ‘Paper Title’) - Script/code examples: Courier New 12 pt -- Kaushal Modi