emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* exporting a big project in multiple files to both pdf and html
@ 2018-01-25 17:37 Alan Schmitt
  2018-02-01  2:17 ` Yasushi SHOJI
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Schmitt @ 2018-01-25 17:37 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

I'm working on a project that is becoming too big to manage as a single
file, so I'm looking at splitting it in several files. This would also
have the benefit of generating several smaller html pages instead of a
single huge one.

My question is about pdf export. Is it possible to take a document made
of multiple org files and generate a single book from it? I'm worried
that if I use a master org file that includes the other ones, the links
between chapters would break.

Is this something you have tackled with? How did you do it?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-12: 406.82, 2016-12: 404.42

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-01-25 17:37 exporting a big project in multiple files to both pdf and html Alan Schmitt
@ 2018-02-01  2:17 ` Yasushi SHOJI
  2018-02-01  8:45   ` Alan Schmitt
  0 siblings, 1 reply; 11+ messages in thread
From: Yasushi SHOJI @ 2018-02-01  2:17 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi,

On Fri, Jan 26, 2018 at 2:37 AM, Alan Schmitt
<alan.schmitt@polytechnique.org> wrote:
> I'm working on a project that is becoming too big to manage as a single
> file, so I'm looking at splitting it in several files. This would also
> have the benefit of generating several smaller html pages instead of a
> single huge one.

Does Org support this? or do you just export each file?

> My question is about pdf export. Is it possible to take a document made
> of multiple org files and generate a single book from it? I'm worried
> that if I use a master org file that includes the other ones, the links
> between chapters would break.

You can just use '#+INCLUDE' construct and Org will take care.
But that will break your follow of exporting html files described above.

How about having two master files, one for html and one for pdf.
In the html-master.org, you use links to connect.  And
in the pdf-master.org, you can just #+INCLUDE your files.

It'd be nice if we could tell exporters that we want multiple files from one
org file.

BTW, I don't think we have direct pdf exporter.  So, you must be talking about
the latex exporter, right?
-- 
           yashi

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-01  2:17 ` Yasushi SHOJI
@ 2018-02-01  8:45   ` Alan Schmitt
  2018-02-01 11:09     ` Yasushi SHOJI
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Schmitt @ 2018-02-01  8:45 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

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

On 2018-02-01 11:17, Yasushi SHOJI <yasushi.shoji@gmail.com> writes:

> On Fri, Jan 26, 2018 at 2:37 AM, Alan Schmitt
> <alan.schmitt@polytechnique.org> wrote:
>> I'm working on a project that is becoming too big to manage as a single
>> file, so I'm looking at splitting it in several files. This would also
>> have the benefit of generating several smaller html pages instead of a
>> single huge one.
>
> Does Org support this? or do you just export each file?

I was planning on exporting each file individually. (It's the main goal,
actually, as exporting the whole thing is taking too long.)

>> My question is about pdf export. Is it possible to take a document made
>> of multiple org files and generate a single book from it? I'm worried
>> that if I use a master org file that includes the other ones, the links
>> between chapters would break.
>
> You can just use '#+INCLUDE' construct and Org will take care.

My problem is links. To give a concrete example, here is the file I want
to split in two:

* A headline
  :PROPERTIES:
  :CUSTOM_ID: head1
  :END:

This is the first file.

* Second headline

The first headline is number [[#head1]]


How do I change the link in the second headline so that I can split the
second headline into its own file and export it by itself? Right now it
cannot resolve the link. Maybe a solution would be to create a custom
link with different ways to export it…


> In the html-master.org, you use links to connect.  And
> in the pdf-master.org, you can just #+INCLUDE your files.

This is the plan, if I find out how to deal with links.

> BTW, I don't think we have direct pdf exporter.  So, you must be talking about
> the latex exporter, right?

Yes, sorry for the confusion.

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-12: 406.82, 2016-12: 404.42

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-01  8:45   ` Alan Schmitt
@ 2018-02-01 11:09     ` Yasushi SHOJI
  2018-02-01 12:29       ` Alan Schmitt
  0 siblings, 1 reply; 11+ messages in thread
From: Yasushi SHOJI @ 2018-02-01 11:09 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi,

On Thu, Feb 1, 2018 at 5:45 PM, Alan Schmitt
<alan.schmitt@polytechnique.org> wrote:
> On 2018-02-01 11:17, Yasushi SHOJI <yasushi.shoji@gmail.com> writes:
>> On Fri, Jan 26, 2018 at 2:37 AM, Alan Schmitt
>> <alan.schmitt@polytechnique.org> wrote:
>>> My question is about pdf export. Is it possible to take a document made
>>> of multiple org files and generate a single book from it? I'm worried
>>> that if I use a master org file that includes the other ones, the links
>>> between chapters would break.
>>
>> You can just use '#+INCLUDE' construct and Org will take care.
>
> My problem is links. To give a concrete example, here is the file I want
> to split in two:
>
> * A headline
>   :PROPERTIES:
>   :CUSTOM_ID: head1
>   :END:
>
> This is the first file.
>
> * Second headline
>
> The first headline is number [[#head1]]
>
>
> How do I change the link in the second headline so that I can split the
> second headline into its own file and export it by itself?

Using [[*A headline]] ?

I might be still missing something but I got following:

$ cat a.org
* A headline

This is the first file.

#+INCLUDE: b.org :minlevel 1

$ cat b.org
* Second headline

The first headline is number [[*A headline]]

$ org-export.sh a.org
$ cat a.tex
% Created 2018-02-01 Thu 20:08
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Yasushi SHOJI}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Yasushi SHOJI},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 26.0.91 (Org mode 9.1.6)},
 pdflang={English}}
\begin{document}

\tableofcontents

\section{A headline}
\label{sec:org0ac96d1}

This is the first file.

\section{Second headline}
\label{sec:org2092415}

The first headline is number \ref{sec:org0ac96d1}
\end{document}


hmm... latex export will generate \ref{sec:\#head}
if you have CUSTOM_ID set.  html exporter works, though.

Is it a bug?
-- 
          yashi

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-01 11:09     ` Yasushi SHOJI
@ 2018-02-01 12:29       ` Alan Schmitt
  2018-02-01 12:56         ` Nicolas Goaziou
  2018-02-02  0:38         ` Yasushi SHOJI
  0 siblings, 2 replies; 11+ messages in thread
From: Alan Schmitt @ 2018-02-01 12:29 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

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

On 2018-02-01 20:09, Yasushi SHOJI <yasushi.shoji@gmail.com> writes:

>> How do I change the link in the second headline so that I can split the
>> second headline into its own file and export it by itself?
>
> Using [[*A headline]] ?
>
> I might be still missing something but I got following:
>
> $ cat a.org
> * A headline
>
> This is the first file.
>
> #+INCLUDE: b.org :minlevel 1
>
> $ cat b.org
> * Second headline
>
> The first headline is number [[*A headline]]
> hmm... latex export will generate \ref{sec:\#head}
> if you have CUSTOM_ID set.  html exporter works, though.

Not here. If I try to export the second file (the one with the link to
the first file), I get an error:

user-error: Unable to resolve link: "*A headline"

This is why I think I need to have the target file name in the link when
exporting it as a standalone file.

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-12: 406.82, 2016-12: 404.42

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-01 12:29       ` Alan Schmitt
@ 2018-02-01 12:56         ` Nicolas Goaziou
  2018-02-01 13:47           ` Alan Schmitt
  2018-02-02  0:38         ` Yasushi SHOJI
  1 sibling, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2018-02-01 12:56 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: Yasushi SHOJI, emacs-orgmode

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> On 2018-02-01 20:09, Yasushi SHOJI <yasushi.shoji@gmail.com> writes:
>
>>> How do I change the link in the second headline so that I can split the
>>> second headline into its own file and export it by itself?
>>
>> Using [[*A headline]] ?
>>
>> I might be still missing something but I got following:
>>
>> $ cat a.org
>> * A headline
>>
>> This is the first file.
>>
>> #+INCLUDE: b.org :minlevel 1
>>
>> $ cat b.org
>> * Second headline
>>
>> The first headline is number [[*A headline]]
>
> …
>
>> hmm... latex export will generate \ref{sec:\#head}
>> if you have CUSTOM_ID set.  html exporter works, though.
>
> Not here. If I try to export the second file (the one with the link to
> the first file), I get an error:
>
> user-error: Unable to resolve link: "*A headline"
>
> This is why I think I need to have the target file name in the link when
> exporting it as a standalone file.

If you don't mind broken links, there's also
`org-export-with-broken-links'.

Regards,

-- 
Nicolas Goaziou

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-01 12:56         ` Nicolas Goaziou
@ 2018-02-01 13:47           ` Alan Schmitt
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Schmitt @ 2018-02-01 13:47 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Yasushi SHOJI, emacs-orgmode

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

On 2018-02-01 13:56, Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> Not here. If I try to export the second file (the one with the link to
>> the first file), I get an error:
>>
>> user-error: Unable to resolve link: "*A headline"
>>
>> This is why I think I need to have the target file name in the link when
>> exporting it as a standalone file.
>
> If you don't mind broken links, there's also
> `org-export-with-broken-links'.

Unfortunately I need working links, so I'll try something else.

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-12: 406.82, 2016-12: 404.42

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-01 12:29       ` Alan Schmitt
  2018-02-01 12:56         ` Nicolas Goaziou
@ 2018-02-02  0:38         ` Yasushi SHOJI
  2018-02-02  7:41           ` Alan Schmitt
  1 sibling, 1 reply; 11+ messages in thread
From: Yasushi SHOJI @ 2018-02-02  0:38 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi,

On Thu, Feb 1, 2018 at 9:29 PM, Alan Schmitt
<alan.schmitt@polytechnique.org> wrote:
> Not here. If I try to export the second file (the one with the link to
> the first file), I get an error:
>
> user-error: Unable to resolve link: "*A headline"

I now see that I totally misread your message.

What you want is to have multiple pdf files, say a.pdf and b.pdf, and link from
a.pdf to some specific page on the b.pdf, right?

I thought you want to generate one pdf from multiple org files.
Since you said "generate a single book from it".

Anyway, I don't know anything about latex, but how do you write such a
link in latex?

Something like this?: https://tex.stackexchange.com/q/41539
-- 
              yashi

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-02  0:38         ` Yasushi SHOJI
@ 2018-02-02  7:41           ` Alan Schmitt
  2018-02-02  9:41             ` Yasushi SHOJI
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Schmitt @ 2018-02-02  7:41 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

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

> What you want is to have multiple pdf files, say a.pdf and b.pdf, and link from
> a.pdf to some specific page on the b.pdf, right?

No, I want multiple html files and a single pdf file generated from
multiple org files. It seems the simplest solution is to call a function
that fixes the links for the pdf export. I'll report here once I have
that function.

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-12: 406.82, 2016-12: 404.42

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-02  7:41           ` Alan Schmitt
@ 2018-02-02  9:41             ` Yasushi SHOJI
  2018-02-02 13:13               ` Alan Schmitt
  0 siblings, 1 reply; 11+ messages in thread
From: Yasushi SHOJI @ 2018-02-02  9:41 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi,

On Fri, Feb 2, 2018 at 4:41 PM, Alan Schmitt
<alan.schmitt@polytechnique.org> wrote:
>> What you want is to have multiple pdf files, say a.pdf and b.pdf, and link from
>> a.pdf to some specific page on the b.pdf, right?
>
> No, I want multiple html files and a single pdf file generated from
> multiple org files. It seems the simplest solution is to call a function
> that fixes the links for the pdf export. I'll report here once I have
> that function.

https://github.com/yashi/multi-html-single-pdf

I have to use macro expansion and `org-export-global-macros` to swap the link.
I don't think we have conditionals to switch an internal and an external link.

HTML outputs are still not good at all (wrong chapter number, excess toc, etc.),
but at least you can see the body of the text.
-- 
       yashi

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

* Re: exporting a big project in multiple files to both pdf and html
  2018-02-02  9:41             ` Yasushi SHOJI
@ 2018-02-02 13:13               ` Alan Schmitt
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Schmitt @ 2018-02-02 13:13 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

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

On 2018-02-02 18:41, Yasushi SHOJI <yasushi.shoji@gmail.com> writes:

> https://github.com/yashi/multi-html-single-pdf
>
> I have to use macro expansion and `org-export-global-macros` to swap the link.
> I don't think we have conditionals to switch an internal and an external link.
>
> HTML outputs are still not good at all (wrong chapter number, excess toc, etc.),
> but at least you can see the body of the text.

This is impressive, thanks a lot. Changing the macro just before calling
the exporter is a great idea.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-12: 406.82, 2016-12: 404.42

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

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

end of thread, other threads:[~2018-02-02 15:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25 17:37 exporting a big project in multiple files to both pdf and html Alan Schmitt
2018-02-01  2:17 ` Yasushi SHOJI
2018-02-01  8:45   ` Alan Schmitt
2018-02-01 11:09     ` Yasushi SHOJI
2018-02-01 12:29       ` Alan Schmitt
2018-02-01 12:56         ` Nicolas Goaziou
2018-02-01 13:47           ` Alan Schmitt
2018-02-02  0:38         ` Yasushi SHOJI
2018-02-02  7:41           ` Alan Schmitt
2018-02-02  9:41             ` Yasushi SHOJI
2018-02-02 13:13               ` Alan Schmitt

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).