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
525 stars 55 forks source link

table defaults #145

Open janrito opened 11 years ago

janrito commented 11 years ago

As a table header for latex, multimarkdown now inserts this code:

\begin{table}[htbp]
\begin{minipage}{\linewidth}
\setlength{\tymax}{0.5\linewidth}
\centering
\small

It seems to me, these are sensible defaults. However, because these are hard-coded into multimarkdown C files, it is impossible to change when needed. A few statements setting these defaults to variables at the beginning of the latex output would allow the customisation of tables via latex header includes.

For example, multimarkdown could do something like this:

\ifx\mmtablewidth\undefined
    \def\mmtablewidth{.5\linewidth}
\fi

\ifx\mmtablefont\undefined
    \def\mmtablefont{\centering\small}
\fi

...

\begin{table}[htbp]
\begin{minipage}{\linewidth}
\setlength{\tymax}{\mmtablewidth}
\mmtablefont
fletcher commented 11 years ago

Reasonable request. I'm pretty busy with release of MultiMarkdown Composer 2.0, but will try to get to this as soon as I can.

janrito commented 11 years ago

Great! Good luck with MMC2.

fletcher commented 11 years ago

Hmmm.... Not sure this will work so easily after all. This assumes that one is creating a "complete" document and there is room for includes and set up information.

If this is a simple "snippet", that code would be non-existent, and the call to "\mmtablewidth", for example, would fail. Otherwise, these \ifx conditionals would have to be included before every table. Or would have to treat the first table differently than subsequent tables. None of which seem like very elegant options.

This might stay on the back burner until a better solution arises... I'm open to suggestions.

janrito commented 11 years ago

I see what you mean. Is there any difference in the latex output (not preamble, etc) when a full document is prepared rather than a fragment?

fletcher commented 11 years ago

No. The actual body is the same either way.

F

Sent from my iPhone

On Apr 27, 2013, at 7:00 AM, Sla notifications@github.com wrote:

I see what you mean. Is there any difference in the latex output (not preamble, etc) when a full document is prepared rather than a fragment?

— Reply to this email directly or view it on GitHubhttps://github.com/fletcher/peg-multimarkdown/issues/145#issuecomment-17114301 .