In a text file metadata.yaml:

title: Title Text
subtitle: Subtitle Text

where obviously "Title Text" and "Subtitle Text" should be replaced with your title and subtitle.

Then add

--metadata-file metadata.yaml

to your pandoc command line.

(The YAML file can be called anything. I used "metadata" for explanatory purposes.)

Also you may get better results if you save the ODT file as a DOCX file in Writer and convert from docx to latex with pandoc.

Den tis 16 maj 2023 17:10Ian Fantom <ian-0jttZa1E5sTe9xe1eoZjHA@public.gmane.org> skrev:
Thanks. Is that

libreoffice --metadata-file

I'm not getting anything.

Ian

On 16/05/2023 11:59, Bastien DUMONT wrote:
> Indeed, Pandoc does not seem to extract the title and the subtitle. I just created an ODT file with the following body:
>
> ```
>     <text:p text:style-name="Title">Title</text:p>
>     <text:p text:style-name="Subtitle">subtitle</text:p>
>     <text:p text:style-name="P1"/>
>     <text:h text:style-name="Heading_20_3" text:outline-level="3">A header</text:h>
> ```
>
> The two first elements are handled as normal paragraph. However, the last element is correctly read as a header level 3.
>
> You could set the title and the subtitle in a metadata file (called with --metadata-file) and remove them from your odt file. As for your headers, we cannot know why Pandoc does not recognize them without looking into your file (are, better, a sample of your file reduced to the strict minimum).
>
> To get the default file for LaTeX, run pandoc -D latex.
>
> Le Tuesday 16 May 2023 à 11:32:32AM, Ian Fantom a écrit :
>> I'm still puzzled on how the correspondences work. I must be misunderstanding
>> something in the Manual ([1]https://pandoc.org/chunkedhtml-demo/
>> 6-templates.html).
>>
>> If I enter 'pandoc -D odt' then I get the contents of the default file for odt,
>> but if I enter 'pandoc -D tex' I get "Could not find data file templates/
>> default.tex".
>>
>> The odt default file contains the lines:
>>
>> - ---------------
>>
>> $for(header-includes)$
>>    $header-includes$
>>
>> ...
>>
>> $if(title)$
>> <text:p text:style-name="Title">$title$</text:p>
>> $endif$
>> $if(subtitle)$
>> <text:p text:style-name="Subtitle">$subtitle$</text:p>
>> $endif$
>>
>>
>> - -----------------------
>>
>> The odt book title is of type 'Title', and the chapter titles are of type
>> 'Subtitle'. Subheadings are of type 'Header 3'. But instead of getting chapter
>> headings I get eg:
>>
>> \protect\hypertarget{anchor-4}{}{}Preface
>>
>> Perhaps someone  could explain.
>>
>> Many thanks,
>>
>> Ian
>>
>>
>> On 15/05/2023 20:26, Ian Fantom wrote:
>>
>>      Well the .odt file uses styles from Writer: Title, Subtitle, Header3.
>>
>>      Would looking up the code used in the .fodt help?
>>
>>      Ian
>>
>>
>>      On 15 May 2023 18:15:06 BST, BPJ [2]<bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:
>>
>>          Probably whoever wrote the ODT file faked the headings by enlarging the
>>          font and applying bold font rather than applying the "Heading 1" etc
>>          named paragraph styles. Only the latter will be recognised as headings
>>          by Pandoc. There are a lot of such files in the wild.
>>
>>          Den mån 15 maj 2023 18:35Ian Fantom <[3]ian-0jttZa1E5sTe9xe1eoZjHA@public.gmane.org> skrev:
>>
>>              I've tried converting a book in .odt (LibreOffice Writer / Ubuntu)
>>              to
>>              .tex and viewing it in Texstudio.
>>
>>              It's not converting any of the headings and subheadings - just
>>              producing
>>              normal text. I used the '-s' and the '-o' options.
>>
>>              I think there must be something I haven't understood in the Pandoc
>>              User
>>              Guide ([4]https://pandoc.org/MANUAL.html)
>>
>>              I was expecting some way of defining a conversion table from Writer
>>              to
>>              Latex. For instance:
>>
>>              'Preface' is in style 'subtitle' in Writer, and is converted to:
>>              '\protect\hypertarget{anchor-4}{}{}Preface' and appears as normal
>>              text
>>              in .tex.
>>
>>              Any ideas how I should proceed?
>>
>>              Thanks, Ian Fantom
>>
>>
>>              --
>>              You received this message because you are subscribed to the Google
>>              Groups "pandoc-discuss" group.
>>              To unsubscribe from this group and stop receiving emails from it,
>>              send an email to [5]pandoc-discuss+unsubscribe@googlegroups.com.
>>              To view this discussion on the web visit [6]https://
>>              groups.google.com/d/msgid/pandoc-discuss/
>>              1201761b-53e9-f3bc-a6b5-4eedaf3b5146%40fantom.org.uk.
>>
>>      --
>>      You received this message because you are subscribed to the Google Groups
>>      "pandoc-discuss" group.
>>      To unsubscribe from this group and stop receiving emails from it, send an
>>      email to [7]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
>>      To view this discussion on the web visit [8]https://groups.google.com/d/
>>      msgid/pandoc-discuss/3BA7371B-D3AC-43A2-B8E3-C6FAB0A977E4%40fantom.org.uk.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email
>> to [9]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
>> To view this discussion on the web visit [10]https://groups.google.com/d/msgid/
>> pandoc-discuss/7316b85d-27a0-abf5-1e0b-09e0c40186fd%40fantom.org.uk.
>>
>> References:
>>
>> [1] https://pandoc.org/chunkedhtml-demo/6-templates.html
>> [2] mailto:bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org
>> [3] mailto:ian-0jttZa1E5sTe9xe1eoZjHA@public.gmane.org
>> [4] https://pandoc.org/MANUAL.html
>> [5] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> [6] https://groups.google.com/d/msgid/pandoc-discuss/1201761b-53e9-f3bc-a6b5-4eedaf3b5146%40fantom.org.uk
>> [7] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> [8] https://groups.google.com/d/msgid/pandoc-discuss/3BA7371B-D3AC-43A2-B8E3-C6FAB0A977E4%40fantom.org.uk?utm_medium=email&utm_source=footer
>> [9] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> [10] https://groups.google.com/d/msgid/pandoc-discuss/7316b85d-27a0-abf5-1e0b-09e0c40186fd%40fantom.org.uk?utm_medium=email&utm_source=footer

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/df607dbb-adfd-e034-7f88-0510ecdfdc3a%40fantom.org.uk.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCnDBnRthrhr_KZnqmEoScyqke1pmfH6okgi6XCZzDOew%40mail.gmail.com.