Linebreak in Metadata

du
dudido
Posts: 24
Joined: Mon Dec 02, 2013 9:04 pm
Platform: Mac + Windows

Sun Mar 01, 2020 7:11 pm Post

Hi,

how do I create a linebreak within metadata?

I'm using the Affiliation key from MMD6 and export using the Memoir (Book) settings to Latex. I checked the MMD6 Documentation which claims:

You can have more than one line in this field --- use two extra spaces at the end of the line, and a newline character will be used in LaTeX.


(Taken from https://github.com/fletcher/MultiMarkdown/wiki/MultiMarkdown-Syntax-Guide#affiliation)

Scrivener doesn't seem to respect that, but I tried passing //, ////, and /n - all to no avail.
--
Thanks for the support.

Using Scrivener 3.1.5 on macOS 10.15.5

Online
User avatar
AmberV
Posts: 24213
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Mar 02, 2020 2:33 pm Post

Hmm, we in fact use a large multiline text field here specifically because that should be valid (and easy to do). You of course have to follow the syntax rules within that field, but I presume you’re doing so. I’ve attached a simple demonstration of a multiline metadata field in action. Here we are supplying a little CSS to the HTML output, using the “HTML Header” metadata field. The compiled result has the expected formatting.
Attachments
multiline_metadata.zip
(98.89 KiB) Downloaded 75 times
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

du
dudido
Posts: 24
Joined: Mon Dec 02, 2013 9:04 pm
Platform: Mac + Windows

Mon Mar 02, 2020 4:48 pm Post

Thank you for your reply and the example. If I export Multimarkdown->HTML your HTML-Header tag is present however line breaks have been removed, too. If I create an additional tag Affiliation in your example and set it to:

Code: Select all

test1 
test2 
test3

this yields the following results -
Multimarkdown -> Latex:
\def\affiliaton{test1 test2 test3}

Multimarkdown->HTML:
<meta name="affiliaton" content="test1 test2 test3"/>


If I understand the MMD6 manual correctly the outcome should be
\def\affiliaton{test1\\test2\\test3}
--
Thanks for the support.

Using Scrivener 3.1.5 on macOS 10.15.5

Online
User avatar
AmberV
Posts: 24213
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Mar 02, 2020 8:03 pm Post

That seems to be something you should report to the MMD discussion board in that case. I do not see what Scrivener would be doing here to alter this result, and indeed if I test MMD directly on the command-line I get the same result you indicated as unexpected behaviour:

Code: Select all

$ mmd2tex
Title: Test Metadata
Affiliation: test1
test2
test3

The End


Output:

Code: Select all

\def\mytitle{Test Metadata}
\def\affiliation{test1 test2 test3}

The End

\end{document}
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

du
dudido
Posts: 24
Joined: Mon Dec 02, 2013 9:04 pm
Platform: Mac + Windows

Mon Mar 02, 2020 9:20 pm Post

Ah - I never considered it was an unexpected behaviour on the part of MMD and didn't get around to testing it on the command line. Yes I'll report the behaviour in that forum. Thanks for helping narrow it down!

Could you think of any work around? I tried

Code: Select all

'test1\\test2\\test3'{=latex}


which yielded

\def\affiliaton{'test1\textbackslash{}\textbackslash{}test2\textbackslash{}\textbackslash{}test3'\{=latex\}}


So even if the passing of two extra spaces does not work in MMD contrary to its manual, I don't see any way at all of passing a line break in the metadata to a Latex output.
--
Thanks for the support.

Using Scrivener 3.1.5 on macOS 10.15.5

Online
User avatar
AmberV
Posts: 24213
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Mar 02, 2020 9:46 pm Post

After having experimented with a few different approaches, it looks like the Markdown convention of adding a single backslash to the end of a line that is intended to be a hard line break is coded to be functional within the Metadata block—and thus visually provides a result that will be familiar to any shell scripter:

Code: Select all

Title: Test Metadata
Affiliation: test1\
test2\
test3
LaTeX Config: article

The End


That typesets correctly in my testing, producing affiliations, one per line, below the author line in the title block. So it may be that what needs to be reported is that the MMD documentation needs to be updated.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

du
dudido
Posts: 24
Joined: Mon Dec 02, 2013 9:04 pm
Platform: Mac + Windows

Tue Mar 03, 2020 6:22 pm Post

Thank you for reasearching this further, I thought I had tried the slash, but clearly I must have not done so. I can confirm that your solution works for me too, and it also seems to be the standard way following this documentation here:

https://fletcher.github.io/MultiMarkdow ... lines.html

After our discussion I posted to the MMD forums here:
http://support.fletcherpenney.net/discu ... n-metadata

There I learned from the developer that the documentation I had found was outdated and refered to MultiMarkdown V2. Unfortunately, it was still being edited by other users since it was a wiki, and therefore gave the impression to be current.

So if other users run into unexpected behaviours on the side of MMD I suggest to double check that they have been checking the correct documentation for the version in use. There are several out there...
--
Thanks for the support.

Using Scrivener 3.1.5 on macOS 10.15.5