emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
@ 2014-03-21 16:30 Konstantin Kliakhandler
  2014-03-21 23:32 ` Bastien
  0 siblings, 1 reply; 16+ messages in thread
From: Konstantin Kliakhandler @ 2014-03-21 16:30 UTC (permalink / raw)
  To: emacs-orgmode


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 <v3.8m> 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-dist/tex/latex/wasysym/uwasy.fd)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) (./org-test.toc)
! Argument of \UL@word has an extra }.
<inserted text> 
                \par 
l.31 \section{\uline{Example Text}}
                                   
Runaway argument?
\@empty 
! Paragraph ended before \UL@word was complete.
<to be read again> 
                   \par 
l.31 \section{\uline{Example Text}}
                                   
Runaway argument?
\global \UL@skip \<let>-command \\\unskip \global \UL@pe \lastpenalty \ETC.
! Paragraph ended before \HyPsd@@ProtectSpacesFi was complete.
<to be read again> 
                   \par 
l.31 \section{\uline{Example Text}}
                                   
! Use of \HyPsd@RemoveMask doesn't match its definition.
\Hy@tempa ->\par 
                 | 
l.31 \section{\uline{Example Text}}
                                   
! Undefined control sequence.
\HyPsd@ProtectSpaces ...d@RemoveMask #1\HyPsd@End 
                                                  #1
l.31 \section{\uline{Example Text}}
                                   
Runaway argument?
{
! Paragraph ended before \HyPsd@RemoveBraces was complete.
<to be read again> 
                   \par 
l.31 \section{\uline{Example Text}}
                                   
! Extra }, or forgotten \endgroup.
\pdfstringdef ...d@RemoveBraces \expandafter {#1|}
                                                  \global \let #1\HyPsd@Stri...
l.31 \section{\uline{Example Text}}
                                   
! Argument of \HyPsd@CheckCatcodes has an extra }.
<inserted text> 
                \par 
l.31 \section{\uline{Example Text}}
                                   
Runaway argument?
\global \let \Hy@tempa \HyPsd@String 
! Paragraph ended before \HyPsd@CheckCatcodes was complete.
<to be read again> 
                   \par 
l.31 \section{\uline{Example Text}}
                                   
)
Runaway argument?
\@empty \HyPsd@End \Hy@tempa \expandafter \HyPsd@Subst \expandafter {\ETC.
! File ended while scanning use of \HyPsd@RemoveMask.
<inserted text> 
                \par 
<*> \input org-test.tex
                       
! Emergency stop.
<*> \input org-test.tex
                       
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on org-test.log.

LaTeX exited abnormally with code 1 at Fri Mar 21 17:53:55
===


------------------------------------------------------------------------



Emacs  : GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2014-01-01 on gkar, modified by Debian
Package: Org-mode version 8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)

current state:
==============
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
		      org-src-native-tab-command-maybe
		      org-babel-hide-result-toggle-maybe
		      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
			  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-log-done 'time
 org-format-latex-options '(:foreground default :background default :scale 3.0
			    :html-foreground "Black" :html-background
			    "Transparent" :html-scale 1.0 :matchers
			    ("begin" "$1" "$" "$$" "\\(" "\\["))
 org-latex-format-inlinetask-function 'ignore
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-pretty-entities t
 org-agenda-custom-commands '(("w" todo "TODO")
			      ("h" agenda "" ((org-agenda-show-all-dates nil)))
			      ("W" agenda ""
			       ((org-agenda-ndays 21)
				(org-agenda-show-all-dates nil))
			       )
			      ("A" agenda ""
			       ((org-agenda-ndays 1)
				(org-agenda-overriding-header "Today"))
			       )
			      )
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-default-notes-file "~/Dropbox/Documents/Org/notes.org"
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
		     org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-pretty-entities-include-sub-superscripts nil
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-show-block-all
		    append local]
		   5]
		 #[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook
		    org-babel-show-result-all append local]
		   5]
		 org-babel-result-hide-spec org-babel-hide-all-hashes
		 setup-org-mode)
 org-use-speed-commands t
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-directory "~/Dropbox/Documents/Org/"
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
		  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
		  org-optimize-window-after-visibility-change)
 org-todo-keywords '((type "TODO(t!)" "STARTED(s)" "WAITING(w@/!)" "|"
		      "CANCELLED(c)" "FUTURE(f)" "DONE(d!)")
		     (type "Note(n)") (type "Event(e)")
		     (sequence "PROJECT(p)" "|" "COMPLETE(c@)"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-html-format-headline-function 'ignore
 org-html-format-inlinetask-function 'ignore
 org-agenda-files '("~/Dropbox/Documents/Org/")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-21 16:30 Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)] Konstantin Kliakhandler
@ 2014-03-21 23:32 ` Bastien
  2014-03-22  8:01   ` Konstantin Kliakhandler
  2014-03-22  8:02   ` Nicolas Goaziou
  0 siblings, 2 replies; 16+ messages in thread
From: Bastien @ 2014-03-21 23:32 UTC (permalink / raw)
  To: Konstantin Kliakhandler; +Cc: emacs-orgmode

Hi Konstantin,

Konstantin Kliakhandler <kosta@slumpy.org> writes:

> It appears that org-mode produces invalid latex code. An example
>  follows.

Fixed, thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-21 23:32 ` Bastien
@ 2014-03-22  8:01   ` Konstantin Kliakhandler
  2014-03-22  8:02   ` Nicolas Goaziou
  1 sibling, 0 replies; 16+ messages in thread
From: Konstantin Kliakhandler @ 2014-03-22  8:01 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

Thanks!

On Sat, Mar 22, 2014 at 1:32 AM, Bastien <bzg@gnu.org> wrote:

> Hi Konstantin,
>
> Konstantin Kliakhandler <kosta@slumpy.org> writes:
>
> > It appears that org-mode produces invalid latex code. An example
> >  follows.
>
> Fixed, thanks,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 726 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-21 23:32 ` Bastien
  2014-03-22  8:01   ` Konstantin Kliakhandler
@ 2014-03-22  8:02   ` Nicolas Goaziou
  2014-03-22  8:27     ` Bastien
  1 sibling, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-03-22  8:02 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Konstantin Kliakhandler

Hello,

Bastien <bzg@gnu.org> writes:

> Konstantin Kliakhandler <kosta@slumpy.org> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22  8:02   ` Nicolas Goaziou
@ 2014-03-22  8:27     ` Bastien
  2014-03-22 11:19       ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Bastien @ 2014-03-22  8:27 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Konstantin Kliakhandler

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22  8:27     ` Bastien
@ 2014-03-22 11:19       ` Nicolas Goaziou
  2014-03-22 11:38         ` Rasmus
  2014-03-22 11:45         ` Konstantin Kliakhandler
  0 siblings, 2 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2014-03-22 11:19 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Konstantin Kliakhandler

Bastien <bzg@gnu.org> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 11:19       ` Nicolas Goaziou
@ 2014-03-22 11:38         ` Rasmus
  2014-03-22 11:45         ` Konstantin Kliakhandler
  1 sibling, 0 replies; 16+ messages in thread
From: Rasmus @ 2014-03-22 11:38 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Bastien <bzg@gnu.org> 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.


-- 
ツ

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 11:19       ` Nicolas Goaziou
  2014-03-22 11:38         ` Rasmus
@ 2014-03-22 11:45         ` Konstantin Kliakhandler
  2014-03-22 12:38           ` Nicolas Goaziou
  1 sibling, 1 reply; 16+ messages in thread
From: Konstantin Kliakhandler @ 2014-03-22 11:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 11:45         ` Konstantin Kliakhandler
@ 2014-03-22 12:38           ` Nicolas Goaziou
  2014-03-22 13:03             ` Bastien
  2014-03-22 17:06             ` Nicolas Richard
  0 siblings, 2 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2014-03-22 12:38 UTC (permalink / raw)
  To: Konstantin Kliakhandler; +Cc: Bastien, emacs-orgmode

Hello,

Konstantin Kliakhandler <kosta@slumpy.org> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 12:38           ` Nicolas Goaziou
@ 2014-03-22 13:03             ` Bastien
  2014-03-22 13:37               ` Nicolas Goaziou
  2014-03-22 17:06             ` Nicolas Richard
  1 sibling, 1 reply; 16+ messages in thread
From: Bastien @ 2014-03-22 13:03 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Konstantin Kliakhandler

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 13:03             ` Bastien
@ 2014-03-22 13:37               ` Nicolas Goaziou
  2014-03-22 14:09                 ` Bastien
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-03-22 13:37 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Konstantin Kliakhandler

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Bastien <bzg@altern.org> 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-Fix-underline-in-sections.patch --]
[-- Type: text/x-diff, Size: 1959 bytes --]

From 7a6bcad9dea5dd8a7c8b15f942191046f63f262f Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 13:37               ` Nicolas Goaziou
@ 2014-03-22 14:09                 ` Bastien
  2014-03-22 14:18                   ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Bastien @ 2014-03-22 14:09 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Konstantin Kliakhandler

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Here is the patch. b399ff0cba2382bf52d5bb6ef2b4a776fe0ac902 needs to be
> reverted first.

Please go ahead, thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 14:09                 ` Bastien
@ 2014-03-22 14:18                   ` Nicolas Goaziou
  0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2014-03-22 14:18 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Konstantin Kliakhandler

Bastien <bzg@gnu.org> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Here is the patch. b399ff0cba2382bf52d5bb6ef2b4a776fe0ac902 needs to be
>> reverted first.
>
> Please go ahead, thanks,

Done.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 12:38           ` Nicolas Goaziou
  2014-03-22 13:03             ` Bastien
@ 2014-03-22 17:06             ` Nicolas Richard
  2014-03-22 20:06               ` Rasmus
  2014-03-22 21:04               ` Konstantin Kliakhandler
  1 sibling, 2 replies; 16+ messages in thread
From: Nicolas Richard @ 2014-03-22 17:06 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode, Konstantin Kliakhandler

Nicolas Goaziou <n.goaziou@gmail.com> 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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 17:06             ` Nicolas Richard
@ 2014-03-22 20:06               ` Rasmus
  2014-03-22 21:04               ` Konstantin Kliakhandler
  1 sibling, 0 replies; 16+ messages in thread
From: Rasmus @ 2014-03-22 20:06 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]
  2014-03-22 17:06             ` Nicolas Richard
  2014-03-22 20:06               ` Rasmus
@ 2014-03-22 21:04               ` Konstantin Kliakhandler
  1 sibling, 0 replies; 16+ messages in thread
From: Konstantin Kliakhandler @ 2014-03-22 21:04 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: Bastien, emacs-orgmode, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

Hello,
On Mar 22, 2014 7:06 PM, "Nicolas Richard" <theonewiththeevillook@yahoo.fr>
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

[-- Attachment #2: Type: text/html, Size: 1617 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-03-22 21:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21 16:30 Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)] Konstantin Kliakhandler
2014-03-21 23:32 ` Bastien
2014-03-22  8:01   ` Konstantin Kliakhandler
2014-03-22  8:02   ` Nicolas Goaziou
2014-03-22  8:27     ` Bastien
2014-03-22 11:19       ` Nicolas Goaziou
2014-03-22 11:38         ` Rasmus
2014-03-22 11:45         ` Konstantin Kliakhandler
2014-03-22 12:38           ` Nicolas Goaziou
2014-03-22 13:03             ` Bastien
2014-03-22 13:37               ` Nicolas Goaziou
2014-03-22 14:09                 ` Bastien
2014-03-22 14:18                   ` Nicolas Goaziou
2014-03-22 17:06             ` Nicolas Richard
2014-03-22 20:06               ` Rasmus
2014-03-22 21:04               ` Konstantin Kliakhandler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).