fletcher / peg-multimarkdown

An implementation of MultiMarkdown in C, using a PEG grammar - a fork of jgm's peg-markdown. No longer under active development - see MMD 5.
Other
523 stars 55 forks source link

4wishlist: Command line switch disable output of Metadata definitions at beginning of the .tex-file #16

Closed wadoli closed 13 years ago

wadoli commented 13 years ago

One thing nice to have for the beta: Would it be possible to add a command line switch to disable the output of the Metadata definitions at the beginning of the file in LaTeX-mode? I'm talking about these lines:

\def\mytitle{This is my title}
\def\myauthor{John Doe}
…

That would be swell.

fletcher commented 13 years ago

Under what circumstances would one want to disable the use of the metadata that one entered into the document?

wadoli commented 13 years ago

I've used latex-snippet.xslt with MMD2 so far (which didn't export any of the meta-data into the .tex-file) and would like to keep the meta-data in the Multimarkdown file for conversions into other formats than LaTeX.

If I include the .tex-file generated by MMD3 with the meta-data definitions at the beginning into my LaTeX frame document it breaks a few things.

This is not a problem if people stick to your recommendations for LaTeX-code generation in MMD3, though (that is, if they work with a LaTeX header- and footer-file). And for myself I can easily fix this with a simple regular expression. I just imagined some other users with a similar work-flow might run into the same problem. You could wait and see, I guess. :-)

fletcher commented 13 years ago

Can you describe some real life examples of this situation? I don't want to flat out say no without better understanding the situation, but it's seeming like a rather unique situation.

jcoulombe commented 13 years ago

Hi,

Don't include your metadata in your mmd source, but in a separate file. Then you can use the plain source in latex to be included in a master document, or prepend the metadata file for html output.

multimarkdown -t latex doc.txt > doc.tex
cat meta.txt doc.txt | multimarkdown > doc.html

Personally, I use (a modified version of) mmdmerge.pl index.txt and use the metadata in a separate file called at the beginning of my index.

Hope it helps.

wadoli commented 13 years ago

That's a good idea, thank you. I'm using Scrivener, though, and even if I delete all of the metadata in the Scrivener compile-dialogue, I still get the following two lines of metadata in the resulting MultiMarkdown file:

Language: German
Format: complete

These turn up as

\def\language{German}
\def\format{complete}

in my LaTeX-snippet. If I leave them there, they somehow redefine my pageheader to begin with «German =» (using the documentclass scrartcl).

I don't need a command line option all for myself, though. I'll use a regex.

jcoulombe commented 13 years ago

A few points:

  1. You can achieve the same as what I proposed earlier with Scrivener. Just put all your metadata in plain text in the very first "scrivening" of your document and include it or not when you compile, according to your needs;
  2. I haven't registered my copy of Scrivener which has expired, so I can't help with the metadata appearing despite using latex-snippet and disabling metadata in the compile dialog, unfortunately. Looks to me like an incomplete transition from MMD2 to MMD3 under the hood within Scrivener, which is understandable since MMD3 hasn't reached beta yet. Not sure. I guess Fletcher is the only one who can help;
  3. The "German=" thing is similar to what I have in French, and I opened a new issue about it (see Issue 18).
wadoli commented 13 years ago

Thank you. For the moment I just use this Perl-one liner to delete the definitions (inspiration taken from here):

perl -ni -e 'print unless /^\\def\\.*/' /path/to/filename

So I'm fine and you can still add a command line option if the need/popular demand arises, Fletcher.

fletcher commented 13 years ago

Sounds good. If we need to revisit this later, we can.

wadoli commented 13 years ago

Scrivener 2.1 allows exporting MultiMarkdown-files without any Meta-data, as long as you don't set a language other than English for SmartyPants in the preferences, see http://www.literatureandlatte.com/forum/viewtopic.php?f=3&t=14854&p=105818

So this wish has vanished.