Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Hello, On Mar 22, 2014 7:06 PM, "Nicolas Richard" wrote: > I'd go even a little further : assuming it makes sense to underline > within a section header, does it also make sense to propagate that > formatting to the toc and/or header of the document ? If not, I suggest > exporting as: > \section[not-so-plain text]{\uline{not-so-plain} \textbf{text}} > I think it sometimes does make sense to highlight in the TOC, for instance if the highlight was intended to emphasize a specific word. Also I don't know why there was underlining in the first place. If we're > asking to underline all section titles, then it might make sense to > redefine e.g. \section to do so (packages titlesec might help). > There was underlining because I wanted to emphasize a single word in the heading (the example I posted was minimal for demonstration purposes), not because all exported sections are underlined. Cheers, Kosta
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Nicolas Richard writes: > Nicolas Goaziou writes: >> It is technically possible to use \underline (hard-coded) in sections >> and \uline (or whatever is defined in`org-latex-text-markup-alist') >> everywhere else. >> >> Is there any downside to this proposal? > > Disclaimer : While I do use LaTeX, I rarely use the exporter, and never > underline in sections. > > (The shed should be green, obviously.) > > I don't know why \uline doesn't work, but while \underline works, it > does so with many warnings. I think the reason is that hyperref tries to > add the text to the PDF TOC (usually a pane in the pdf viewer), and that > supports very little to no formatting. > > Rasmus' suggestion seemed good, i.e. > \texorpdfstring{\uline{SECTION}}{SECTION} > > I'd go even a little further : assuming it makes sense to underline > within a section header, does it also make sense to propagate that > formatting to the toc and/or header of the document ? If not, I suggest > exporting as: > \section[not-so-plain text]{\uline{not-so-plain} \textbf{text}} This we cannot know before hand and for all cases. I cannot think of any case where you would use any kind of styling—other than math—in section titles. Yet others might and I think this suggestion is too strong of an "assumption". Perhaps it could be provided as an option. > Also I don't know why there was underlining in the first place. If we're > asking to underline all section titles, then it might make sense to > redefine e.g. \section to do so (packages titlesec might help). Yeah, that would be a better approach if the underlines are not one-off. . . Rasmus -- C is for Cookie
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Nicolas Goaziou writes: > It is technically possible to use \underline (hard-coded) in sections > and \uline (or whatever is defined in`org-latex-text-markup-alist') > everywhere else. > > Is there any downside to this proposal? Disclaimer : While I do use LaTeX, I rarely use the exporter, and never underline in sections. (The shed should be green, obviously.) I don't know why \uline doesn't work, but while \underline works, it does so with many warnings. I think the reason is that hyperref tries to add the text to the PDF TOC (usually a pane in the pdf viewer), and that supports very little to no formatting. Rasmus' suggestion seemed good, i.e. \texorpdfstring{\uline{SECTION}}{SECTION} I'd go even a little further : assuming it makes sense to underline within a section header, does it also make sense to propagate that formatting to the toc and/or header of the document ? If not, I suggest exporting as: \section[not-so-plain text]{\uline{not-so-plain} \textbf{text}} Also I don't know why there was underlining in the first place. If we're asking to underline all section titles, then it might make sense to redefine e.g. \section to do so (packages titlesec might help). -- Nico.
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Bastien writes: > Nicolas Goaziou writes: > >> Here is the patch. b399ff0cba2382bf52d5bb6ef2b4a776fe0ac902 needs to be >> reverted first. > > Please go ahead, thanks, Done. Regards, -- Nicolas Goaziou
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Nicolas Goaziou writes: > Here is the patch. b399ff0cba2382bf52d5bb6ef2b4a776fe0ac902 needs to be > reverted first. Please go ahead, thanks, -- Bastien
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Bastien writes: > I don't know but it looks good to me, because the shortcomings of > \underline not being able to wrap are not a problem for sections. Here is the patch. b399ff0cba2382bf52d5bb6ef2b4a776fe0ac902 needs to be reverted first. Regards, -- Nicolas Goaziou >From 7a6bcad9dea5dd8a7c8b15f942191046f63f262f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 22 Mar 2014 14:23:23 +0100 Subject: [PATCH] ox-latex: Fix underline in sections * lisp/ox-latex.el (org-latex-headline): Hard-code "\underline" in sections because "\uline" ("ulem" package) returns an error and "\ul" ("soul" package) doesn't support chinese characters. See http://permalink.gmane.org/gmane.emacs.orgmode/83962 for the related thread. --- lisp/ox-latex.el | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 3d51ce5..b49a157 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1344,7 +1344,16 @@ holding contextual information." ((= (length sec) 4) (if numberedp (concat (car sec) "\n%s" (nth 1 sec)) (concat (nth 2 sec) "\n%s" (nth 3 sec))) - (text (org-export-data (org-element-property :title headline) info)) + ;; Create a temporary export back-end that hard-codes + ;; "\underline" within "\section" and alike. + (section-back-end + (org-export-create-backend + :parent 'latex + :transcoders + '((underline . (lambda (o c i) (format "\\underline{%s}" c)) + (text + (org-export-data-with-backend + (org-element-property :title headline) section-back-end info)) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property :todo-keyword headline))) @@ -1397,8 +1406,9 @@ holding contextual information." (let ((opt-title (funcall org-latex-format-headline-function todo todo-type priority - (org-export-data - (org-export-get-alt-title headline info) info) + (org-export-data-with-backend + (org-export-get-alt-title headline info) + section-back-end info) (and (eq (plist-get info :with-tags) t) tags (if (and numberedp opt-title (not (equal opt-title full-text)) -- 1.9.1
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Hi Nicolas, Nicolas Goaziou writes: > It is technically possible to use \underline (hard-coded) in sections > and \uline (or whatever is defined in`org-latex-text-markup-alist') > everywhere else. > > Is there any downside to this proposal? I don't know but it looks good to me, because the shortcomings of \underline not being able to wrap are not a problem for sections. -- Bastien
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Hello, Konstantin Kliakhandler writes: > If it matters, I think that it would be preferable to solve it in a way that > exports the intended emphasis, rather than deletes it (although I'm not > sure how to acheive thise). > > Surely there is a latex command that underlines stuff inside section > headings as well? It is technically possible to use \underline (hard-coded) in sections and \uline (or whatever is defined in`org-latex-text-markup-alist') everywhere else. Is there any downside to this proposal? Regards, -- Nicolas Goaziou
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Nicolas Goaziou writes: > This comes from commit 4fc03ec1fe23c6ddccffaa064a282b258ca8b6b8. > > See thread at: > > http://comments.gmane.org/gmane.emacs.orgmode/67741 If it matters, I think that it would be preferable to solve it in a way that exports the intended emphasis, rather than deletes it (although I'm not sure how to acheive thise). Surely there is a latex command that underlines stuff inside section headings as well? Regards, Kosta
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Nicolas Goaziou writes: > Bastien writes: > >> Yes, maybe there is a better fix. >> >> If you can find why you used \uline instead of \ul that will help >> spot possible problems with the current fix, of course. >> >> I'm not for getting rid of the problem before we can tell for sure >> why the current solution is wrong. > > This comes from commit 4fc03ec1fe23c6ddccffaa064a282b258ca8b6b8. > > See thread at: > > http://comments.gmane.org/gmane.emacs.orgmode/67741 Another possible fix is to (i) check if hyperref is being used, and (ii) escape using \texorpdfstring{\uline{SECTION}}{SECTION}. This also works with stuff like $\bm{\beta}$. Sometimes it also helps to pass the arguments 'unicode, psdextra' to hyperref, but it doesn't work in this case. -- ツ
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Bastien writes: > Yes, maybe there is a better fix. > > If you can find why you used \uline instead of \ul that will help > spot possible problems with the current fix, of course. > > I'm not for getting rid of the problem before we can tell for sure > why the current solution is wrong. This comes from commit 4fc03ec1fe23c6ddccffaa064a282b258ca8b6b8. See thread at: http://comments.gmane.org/gmane.emacs.orgmode/67741 Regards, -- Nicolas Goaziou
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Hi Nicolas, Nicolas Goaziou writes: > I don't think this is the right fix. IIRC, I replaced "\ul" with > "\uline" a while ago for some reason (maybe a problem with newline > or unicode, I cannot remember). This would go backwards. > > There are probably other solutions (e.g., remove all underline markup in > sections). Yes, maybe there is a better fix. If you can find why you used \uline instead of \ul that will help spot possible problems with the current fix, of course. I'm not for getting rid of the problem before we can tell for sure why the current solution is wrong. -- Bastien
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Hello, Bastien writes: > Konstantin Kliakhandler writes: > >> It appears that org-mode produces invalid latex code. An example >> follows. > > Fixed, thanks, I don't think this is the right fix. IIRC, I replaced "\ul" with "\uline" a while ago for some reason (maybe a problem with newline or unicode, I cannot remember). This would go backwards. There are probably other solutions (e.g., remove all underline markup in sections). Regards, -- Nicolas Goaziou
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Thanks! On Sat, Mar 22, 2014 at 1:32 AM, Bastien wrote: > Hi Konstantin, > > Konstantin Kliakhandler writes: > > > It appears that org-mode produces invalid latex code. An example > > follows. > > Fixed, thanks, > > -- > Bastien >
Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Hi Konstantin, Konstantin Kliakhandler writes: > It appears that org-mode produces invalid latex code. An example > follows. Fixed, thanks, -- Bastien
[O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
Hello, It appears that org-mode produces invalid latex code. An example follows. Best, Kosta Insert the following example text into an org buffer: === * _Example Text_ === Then export as latex. The following is produced: === % Created 2014-03-21 Fri 17:45 \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 \author{Author Name} \date{\today} \title{org-bug.org} \hypersetup{ pdfkeywords={}, pdfsubject={}, pdfcreator={Emacs 24.3.50.1 (Org mode 8.2.5h)}} \begin{document} \maketitle \tableofcontents \section{\uline{Example Text}} \label{sec-1} % Emacs 24.3.50.1 (Org mode 8.2.5h) \end{document} === It appears that \uline inside \section is invalid. pdflatex output follows: === Running `LaTeX' on `org-test' with ``pdflatex --synctex=1 -interaction=nonstopmode "\input" org-test.tex'' This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian) restricted \write18 enabled. entering extended mode LaTeX2e <2011/06/27> Babel and hyphenation patterns for english, dumylang, nohyphenation, loaded. (./org-test.tex (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu) (/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu) (/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu))) (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def)) (/usr/share/texlive/texmf-dist/tex/latex/base/fixltx2e.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty) (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg) (/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty (/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty) (/usr/share/texlive/texmf-dist/tex/latex/float/float.sty) (/usr/share/texlive/texmf-dist/tex/latex/wrapfig/wrapfig.sty) (/usr/share/texlive/texmf-dist/tex/latex/rotating/rotating.sty (/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty)) (/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty (/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def (/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.dfu))) (/usr/share/texlive/texmf-dist/tex/latex/marvosym/marvosym.sty) (/usr/share/texlive/texmf-dist/tex/latex/wasysym/wasysym.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty)) (/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty) (/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def) (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg) (/usr/share/texlive/texmf-dist/tex/latex/url/url.sty)) Package hyperref Message: Driver (autodetected): hpdftex. (/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)) (./org-test.aux) (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd) (/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty) (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) (/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty)) (./org-test.out) (./org-test.out) (/usr/share/texlive/texmf-d