[O] Oversized inline math mode leading to corrupted HTML output (OLD exporter)

2013-06-26 Thread Gunnar Wolf
Hi,

I am using the *old* exporter (the packaged version in Debian Wheezy),
I don't know if this behaviour keeps happening with the new one. I
have come up with a minimal case that exhibits this problem — Might be
my fault for using this feature wrongly, but it *feels* as a parser
error.

The problem happens only when outputting HTML, using «OPTIONS:
LaTeX:dvipng» in my document preamble, and in a list context. The full
test document is:

   /
   | #+TITLE: Testing inline math within lists for HTML exporter
   | #+OPTIONS: LaTeX:dvipng
   | #+INFOJS_OPT: tdepth:2 sdepth:2 ftoc:nil ltoc:nil
   | #+LINK_UP: index.html
   | #+LINK_HOME: index.html
   | #+STYLE: 
   | 
   | * Foo
   | - Foo bar baz $(100-3 + 128) \times 4KB = 900KB$ bar foo foo baz bar
   |   baz bar bar baz. Foo baz.
   | - Quux foo bar bar foo a $(100-3 + 128 + (128 \times 128) ) \times 4KB
   |   = 66436KB$, bar foo quux bar foo baz baz.
   | - Foo bar. Bar baz foo foo baz bar $(100-3 + 128 + (128 \times 128) +
   |   (128 \times 128 \times 128) ) \times 2KB = 8455044 \approx 8GB$, foo
   |   foo bar baz.
   \

What happens here? I think the parser fails to see where the math mode
ends. The LaTeX snippet is generated correctly (that is, the image in
ltxpng/ is generated correctly, but the output to the "alt" attribute
of the  tag is cut at the first newline. I'm pasting here just
the generated :

   /
   | 
   | Foo bar baz  bar foo foo baz bar
   |   baz bar bar baz. Foo baz.
   | 
   | Quux foo bar bar foo a 

Re: [O] Tables for attendance lists - A problem understanding TBLFM?

2013-04-09 Thread Gunnar Wolf
Nick Dokos dijo [Tue, Apr 09, 2013 at 12:03:33PM -0400]:
> Ah, OK - I guess Gunnar will not be able to avoid an upgrade to something
> more recent.
> 
> And yes, the eq/equal subtleties strike once again:
> 
> (eq "" "")
> t
> (eq "0" "0")
> nil
> (equal "0" "0")
> t

Yay - Thanks to you all :-) Yes, it finally works fine for me with
(delete "0" [...])

Of course, at some point I will upgrade. We shall see if the world
breaks and hell ensues. But right now, I'm happy and satisfied. And
I'll study a bit more into the relative addressing you posted, as it
surely looks better suited.



Re: [O] Tables for attendance lists - A problem understanding TBLFM?

2013-04-09 Thread Gunnar Wolf
(Quoting in full to preserve mail readability without resorting to too
much context)

> > > #+CAPTION: Attendances for April
> > > |-+---+---+---+---+---++---|
> > > | Account | Name  | 1 | 3 | 5 | 8 | 10 | Total |
> > > |-+---+---+---+---+---++---|
> > > |1234 | Cárdenas, Lázaro  | X |   | X | X || 3 |
> > > |5678 | Madero, Francisco | X | X | X | X || 4 |
> > > |1544 | Villa, Pancho |   |   |   |   || 0 |
> > > |0113 | Zapata, Emiliano  |   | X | X |   || 2 |
> > > |-+---+---+---+---+---++---|
> > > #+tblfm: @II+1$>..@III-1$>='(length (delq "" '($<<<..$>>)))
> >
> > Interesting, my org-mode version behaves differently, and still gives
> > '1' for the empty row with your version:
> >
> > Substitution history of formula
> > (...)
> > @r$c-> '(length (delq "" '("0")))
> > $1->   '(length (delq "" '("0")))
> > Result: 1
> >
> Check the formula again: you seem to have captured the 0 from the last
> column, instead of stopping at the penultimate column. The range should
> be $3..$>> or $<<<..$>>  - also, you should have posted the whole
> substitution history so we could see the range, instead of me guessing. The
> motto should be "More information is better than less", but of course that
> should be tempered by common sense :-)

Trying with:

#+tblfm: @II+1$>..@III-1$>='(length(delq "" '($3..$>>)))

The full substitution history is:

Substitution history of formula
Orig:   '(length(delq "" '($3..$7)))
$xyz->  '(length(delq "" '($3..$7)))
@r$c->  '(length(delq "" '("0")))
$1->'(length(delq "" '("0")))
Result: 1
Format: NONE
Final:  1

Changing the $3 for $<<< yields the exact same result. I cannot see
any "0" - As far as I can understand, the evaluation of an empty
vector for (length ...) gives this "0" ?



Re: [O] Tables for attendance lists - A problem understanding TBLFM?

2013-04-09 Thread Gunnar Wolf
Michael Brand dijo [Tue, Apr 09, 2013 at 02:40:06PM +0200]:
> On Tue, Apr 9, 2013 at 5:31 AM, Nick Dokos  wrote:
> > You can turn on formula debugging with C-c { and then you'd
> > see that in Pancho's case, the list is ("") i.e. a list containing the
> > empty string - a list of length 1. That might qualify as a bug (or not)
> 
> This issue is part of some old bugs that I discovered end of 2012. It
> seems like my patch from then
> http://orgmode.org/w/org-mode.git?p=org-mode.git;a=commitdiff;h=764315
> resolved it only partially and I missed the case of a range with only
> empty fields, although I tested and approved it in my ERTs... The
> attached patch corrects.
> 
> It is worth a small compatibility change: For a range with only empty
> fields it is now possible and necessary to choose different behaviors
> of vmean by adding the format specifiers E and/or N.

Yes - it seems it is this bug you mention. I prefer not to patch my
.el if possible, as being me a non-hard-core, non-bleeding-edge
Org-mode user, I prefer following what comes in my Debian package ;-)



Re: [O] Tables for attendance lists - A problem understanding TBLFM?

2013-04-09 Thread Gunnar Wolf
Nick Dokos dijo [Mon, Apr 08, 2013 at 11:31:14PM -0400]:
> You can turn on formula debugging with C-c { and then you'd
> see that in Pancho's case, the list is ("") i.e. a list containing the
> empty string - a list of length 1. That might qualify as a bug (or not) but
>  
> you can easily work around it, using (delq "" list) which deletes empty
> strings from the list.

Ok - I was not sure on how to use/interpret the debugging facility,
but it will surely help me

> Try this:
> 
> #+CAPTION: Attendances for April
> |-+---+---+---+---+---++---|
> | Account | Name  | 1 | 3 | 5 | 8 | 10 | Total |
> |-+---+---+---+---+---++---|
> |1234 | Cárdenas, Lázaro  | X |   | X | X || 3 |
> |5678 | Madero, Francisco | X | X | X | X || 4 |
> |1544 | Villa, Pancho |   |   |   |   || 0 |
> |0113 | Zapata, Emiliano  |   | X | X |   || 2 |
> |-+---+---+---+---+---++---|
> #+tblfm: @II+1$>..@III-1$>='(length (delq "" '($<<<..$>>)))

Interesting, my org-mode version behaves differently, and still gives
'1' for the empty row with your version:

Substitution history of formula
(...)
@r$c-> '(length (delq "" '("0")))
$1->   '(length (delq "" '("0")))
Result: 1

I tried substituting the empty quotes in the 'delq' with "0", '(""),
'("0")... but always got the same result: 1.

> I kept just one formula for clarity. I also tried to avoid absolute
> row and column numbers (the $3 seemed better than $<<< though
> so I kept it)
> : @II is the second separator, $> is the last column
> and $>> is the penultimate column.

Right, I want to better understand relative addressing, as each month
has a different number of columns (and some have different number of
rows), and I'd prefer having the same formulas everywhere. How would
you suggest me to address "from the third and until the next-to-last
column"?



Re: [O] converting people to Emacs and org-mode

2013-04-09 Thread Gunnar Wolf
42 147 dijo [Tue, Apr 09, 2013 at 04:10:07AM -0400]:
> 
> Hello mailing list,
> 
> This might be considered off-topic.
> 
> The question is the title: have you been able to convert many people to
> Emacs / org-mode? Are converts all programmers, or those versed in
> programming? -- Or have you converted non-programmers, e.g., anyone who
> edits text for a living?
> (...)

I won't talk about the people I have (not yet) converted, but about
the person who converted me: I am a long-time Emacs user (got
initiated back in 1983, being 6 or 7 years old, at the university
where my father worked, works, and where I now work as well). We spent
many Friday nights at the terminal room, he was working on some
proceedings book compilation and I was getting exposed to computers
when few had chance. So, yes, I got started on TeX and Emacs at quite
an early age. And they deformed my mind forever, it seems.

One of the factors that led me to switch to a Linux environment in the
mid-90s was that both tools I cherished (but hadn't touched in almost
ten years) were readily available. And while I did nothing with TeX
for many years (using LyX for the occasional writeup), Emacs became
very early part of my sysadmin tools, and later, my programming buddy.

Still more years passed. Between 2009 and 2011, I edited a book for
the university — «Construcción colaborativa del conocimiento»,
studying the free software / free culture movements. The process was
most interesting, but quite painful - We did the inter-author
collaboration using a Web framework, and it was up to me to convert
the final version to LaTeX and typeset it adequately. In the end, we
got quite a good result¹, which you can download if you find
interesting (written in Spanish).

Talking about the woes in the conversion, an anthropologist (and a
very good friend of mine) suggested me to take a look at org-mode. I
had previously just heard about it and dismissed it because I can
perfectly do without yet-another-todo-list-manager (which is what I
thought Org was). But after he showed me the ease with which he writes
his articles and was halfway through his doctoral thesis, intermixing
LaTeX bits, exporting to PDF and HTML, easily producing the Beamer
slides I took so much pride in having mastered... I got converted
right away.

That was just six months ago. I now write all of my articles and
presentations in Org, and am halfway through (yet another) book.

¹ http://seminario.edusol.info/



Re: [O] Tables for attendance lists - A problem understanding TBLFM?

2013-04-08 Thread Gunnar Wolf
Suvayu Ali dijo [Tue, Apr 09, 2013 at 02:25:19AM +0200]:
> On Mon, Apr 08, 2013 at 06:57:53PM -0500, Gunnar Wolf wrote:
> > #+CAPTION: Attendances for April
> > |-+---+---+---+---+---++---|
> > | Account | Name  | 1 | 3 | 5 | 8 | 10 | Total |
> > |-+---+---+---+---+---++---|
> > |1234 | Cárdenas, Lázaro  | X |   | X | X || 3 |
> > |5678 | Madero, Francisco | X | X | X | X || 4 |
> > |1544 | Villa, Pancho |   |   |   |   || 1 |
> > |0113 | Zapata, Emiliano  |   | X | X |   || 2 |
> > |-+---+---+---+---+---++---|
> > | Day avg | 2.25  | 2 | 2 | 3 | 2 |  1 |  2.50 |
> > |-+---+---+---+---+---++---|
> > #+tblfm: @2$8..@5$8='(length 
> > '($3..$7))::@6$2=vmean($3..$7);%.2f::@6$3..@6$7='(length 
> > '(@2..@5))::@6$8=vmean(@2..@5);%.2f
> 
> Probably not what you were looking for, why complicate things by using
> Xs instead of just a numeral like 1?  If you use 1, then you can use a
> column formula; maybe something like $>=sum($3..$-1).

I had though about it, and it's currently a last resort for me. I want
to publish the lists in the course's webpage, and while a '1' would do
for me, I'd rather present to the students something they are more
likely to understand as natural.



[O] Tables for attendance lists - A problem understanding TBLFM?

2013-04-08 Thread Gunnar Wolf
Hi,

As mostly everything for my class work is handled through org-mode, I
am trying to use it also for tracking attendance. And it almost works
(given my quite-probably-wrong way to solve it) — Can you help me
pinpoint what am I doing wrong?

In case it's not obvious, I'm a complete Lisp newbie.

My attendance tables look similar to:

#+CAPTION: Attendances for April
|-+---+---+---+---+---++---|
| Account | Name  | 1 | 3 | 5 | 8 | 10 | Total |
|-+---+---+---+---+---++---|
|1234 | Cárdenas, Lázaro  | X |   | X | X || 3 |
|5678 | Madero, Francisco | X | X | X | X || 4 |
|1544 | Villa, Pancho |   |   |   |   || 1 |
|0113 | Zapata, Emiliano  |   | X | X |   || 2 |
|-+---+---+---+---+---++---|
| Day avg | 2.25  | 2 | 2 | 3 | 2 |  1 |  2.50 |
|-+---+---+---+---+---++---|
#+tblfm: @2$8..@5$8='(length 
'($3..$7))::@6$2=vmean($3..$7);%.2f::@6$3..@6$7='(length 
'(@2..@5))::@6$8=vmean(@2..@5);%.2f

The formula tries to fill all of the numeric values (last row and
column), but has two important bugs. First, the (attempted) logic:

- Last column includes the sum of nonempty cells. I did this by
  counting the vector's length — But, as you can see, Pancho Villa
  lives up to his rebel's name and has consistently failed to come to
  class. Still, his entry shows he attended once.

  Digging a bit, I found (via M-:) that while (vconcat "X" nil "X" "X")
  yields a three element vector [88 88 88], and (vconcat nil nil nil)
  correctly yields an empty vector []. Getting the length of []
  correctly gives 0. So, I must be doing something wrong. Can you spot
  it?

- This same problem happens of course, getting the daily averages —
  We haven't yet reached April 10, but it shows one attendance.

So, is there a way to unb0rk my lists? Org-mode seems to be quite well
equiped for this task, and I'd hate to use other tools if I can stick
to this :)



[O] [new exporter] Guides on what incompatibilities to watch for?

2013-02-19 Thread Gunnar Wolf
Hi,

I'm not very specific in this mail, but am wondering…

I have some nontrivial documents written in Org-mode. My main use case
for Org is mostly to author texts, rather than using its time-tracking
features. I fear that with the new exporter, several of my documents'
features will no longer work or -worse- be interpretted differently,
having a negative impact in my output.

Is there a guide on what items should I mostly watch for (or even
better, what syntax changes should I make) to get my results as
similar as possible to what I had beforehand?

I am not yet running with the new release; as I follow the Debian
packaging, I'll rather wait until it "lands" in my system. Still, I
want to prepare and not let this get me off-guard!



Re: [O] Babel-generated files not part of published projects?

2013-01-31 Thread Gunnar Wolf
Bastien dijo [Thu, Jan 31, 2013 at 02:42:27PM +0100]:
> > When I export a single file (i.e. with C-c C-e p), the file gets
> > generated with the specified filename and included in the resulting
> > PDF. However, when I do it via org-publish-all (or
> > org-publish-project), the code does not get executed, and the
> > resulting files are missing the diagramas.
> >
> > What am I missing?
> 
> Most probably the ltxpng/ directory is not reachable/known or set
> correctly the publishing project.

Hi,

No, I thought about it as well, but I now create the directory just
before calling org-publish-project — This snippet might sound silly,
but please bear in mind it's just a part of a bigger project :) I have
this in my project Makefile:

/
| html:
|   mkdir -p html/ltxpng
|   echo html | emacs --batch --load ~/.emacs --load publish.el --funcall 
org-publish-project
| 
| pdf:
|   mkdir -p pdf/ltxpng
|   echo pdf | emacs --batch --load ~/.emacs --load publish.el --funcall 
org-publish-project
| 
| publish:
|   emacs --batch --load ~/.emacs --load publish.el --funcall 
org-publish-all

My ~/.emacs file does include the needed declarations for Babel to
evaluate the blocks:

(org-babel-do-load-languages 'org-babel-load-languages  '((dot . t)) )
(defun my-org-confirm-babel-evaluate (lang body)
  (not (or (string= lang "dot") (string= lang "ditaa"
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)

The only information I can get from the buid process is that LaTeX
does not find the needed files (and that can be reproduced just by
running latex on the generated .tex files):

LaTeX Warning: File `ltxpng/estados_proceso.png' not found on input line 94.
! Package pdftex.def Error: File `ltxpng/estados_proceso.png' not found.
(...)
LaTeX Warning: File `ltxpng/bloqueo_mutuo_simple.png' not found on input 
line 1300.
! Package pdftex.def Error: File `ltxpng/bloqueo_mutuo_simple.png' not 
found.

The only thing I see is that when Org-mode exports to LaTeX, it does
not run the Babel blocks.

Any ideas?



[O] Babel-generated files not part of published projects?

2013-01-30 Thread Gunnar Wolf
Hi,

I have the following (partial) target as a publishing declaration:

(setq org-publish-project-alist
  '(("notas-html"
 :base-directory "~/vcs/sistemas_operativos/notas/"
 :base-extension "org"
 :publishing-directory "~/vcs/sistemas_operativos/html"
 :recursive t
 :publishing-function org-publish-org-to-html
 :headline-levels 4
 :timestamp nil
 :creator-info nil
 :todo-keywords nil
 :html-preamble ""
 :html-postamble ""
 :auto-preamble t
 )
("notas-pdf"
 :base-directory "~/vcs/sistemas_operativos/notas/"
 :base-extension "org"
 :publishing-directory "~/vcs/sistemas_operativos/pdf"
 :recursive t
 :publishing-function org-publish-org-to-pdf
 :headline-levels 4
 :auto-preamble t
 )
 (...)
))

And I have several Dot-generated snippets as part of my text, such as
this one:

#+begin_src dot :file ltxpng/estados_proceso.png
digraph G {
layout = dot;
node [shape = box];
(...)
}
#+end_src

When I export a single file (i.e. with C-c C-e p), the file gets
generated with the specified filename and included in the resulting
PDF. However, when I do it via org-publish-all (or
org-publish-project), the code does not get executed, and the
resulting files are missing the diagramas.

What am I missing?

Thanks,



Re: [O] More decoration for babel output

2013-01-24 Thread Gunnar Wolf
Gunnar Wolf dijo [Wed, Jan 23, 2013 at 11:25:43AM -0600]:
> > When exporting to HTML I always add some extra CSS to my org-mode
> > config, for the purpose of identifying which chunks are input
> > vs. output, and for identifying the language of the code in code
> > chunks.  Language is identified by a little label on the box, and
> > input/output is identified by green/red.
> > 
> > Would this be helpful to include by default?  Patch attached.
> 
> As for me, with slight adaptations, I am including it in my operating
> systems class notes. Thanks!

FWIW, the only changes I did to your css is to use darker backgrounds
(#33 instead of #F5FFF5), as the code is hardwired to somewhat
inconvenient colors (some very dark, some very bright) and the result
was hard to read.



Re: [O] More decoration for babel output

2013-01-23 Thread Gunnar Wolf
Ken Williams dijo [Wed, Jan 23, 2013 at 04:26:54PM +]:
> Hi all,
> 
> When exporting to HTML I always add some extra CSS to my org-mode
> config, for the purpose of identifying which chunks are input
> vs. output, and for identifying the language of the code in code
> chunks.  Language is identified by a little label on the box, and
> input/output is identified by green/red.
> 
> Would this be helpful to include by default?  Patch attached.

As for me, with slight adaptations, I am including it in my operating
systems class notes. Thanks!



Re: [O] Regarding Babel execution

2013-01-15 Thread Gunnar Wolf
Gunnar Wolf dijo [Tue, Jan 15, 2013 at 12:58:30PM -0600]:
> I currently commented out the #+begin_center and #+end_center
> statements, but I'd really like to have them back. Or, at least, to
> find a more proper way to mark the images (and captions!) as material
> that should be distinguished from the flowing text. Something along
> the lines of the LaTeX «figure» environment.

Ok, I'm making it clearer and clearer I am a novice: Adding a
#+caption: makes the LaTeX-generated output carry the captions. How
can I make them appear as well in the HTML export?

Thanks,



[O] Regarding Babel execution

2013-01-15 Thread Gunnar Wolf
Hi,

I recently switched from having several Graphviz files to inlining
them via Babel in my source Org file. However, I noticed something
that might either be strange, or might just mean I don't yet
understand some stuff (as a relative newbie): I usually follow this
pattern to include my graphics:

#+begin_center
#+attr_html: height="350"
#+attr_latex: width=0.5\textwidth
[[./img/foo.png]]

This is the caption for foo.png
#+end_center

But if I try to replace this [[./img/foo.png]] with a
«#+begin_src dot» block, it does not get picked up by Babel (and ends
up in the generated document as a syntax-highlighted block — So,
clearly, org-mode understands it's a source block, but Babel ignores
it).

I currently commented out the #+begin_center and #+end_center
statements, but I'd really like to have them back. Or, at least, to
find a more proper way to mark the images (and captions!) as material
that should be distinguished from the flowing text. Something along
the lines of the LaTeX «figure» environment.

Thanks,