Meta-Tags

I am testing the use of Scrivener for writing documents in the science/engineering field. As a preface, I should note, my intent is to prepare a document for typesetting via LaTeX.

I am interested in finding an application that allows me to do the Authoring stage of a document without being overly encumbered by considerations about the Designing stage, yet will also allow me (within the same application) to tweak at the Designing stage when I am ready.

In the first regard (easy Authoring without overbearing Design considerations), Scrivener is superb!

I am having some frustration about the latter stage-primarily in the need for me to go through the two step process Scrivener -> Multi-MarkDown -> LaTeX.

As an option to this, I suggest that Scrivener support what I might call “Meta-Tags”. They would be invoked within Scrivener in the same way as Links are invoked, however they would be exported in place of RTF markup commands.

Here is an example to illustrate what I have in mind. Items enclosed in {} are “tagged”, with the tag “number” given as _N as a reference (it does not appear in the text). The tags are expanded below the example. In each tag, the “#” sign indicates, the item within the {} is to be substituted when the text is exported.


{Overview}_1

A discussion of {materials}_2 should begin with a description of what they are. Here is a picture that illustrates the paradigm we will use

{materialfigure}_3 <== a PDF image

1: \section{#}
2: \label{#}
3: \includegraphics[width=0.75\linespace]{#}

When exported as TEXT+Meta-Tags, the above becomes …

\section{Overview}

A discussion of \label{materials} should begin with a description of what they are. Here is a picture that illustrates the paradigm we will use

\includegraphics[width=0.75\linespace]{materialfigure}


Of course, meta-tags could also be used to do a direct Scrivener -> HTML export of the same file …

1:

#


2: #
3:

I certainly understand and fully appreciate the comments that Scrivener is not intended to be an HTML/LaTeX/… editor. However, for those who are proficient in such markup languages, the inclusion of something like “meta-tags” would give us a signficant timesaving ability at the document Design stage to tweak DIRECTLY (and at our own risk of course!!!) within Scrivener.

This would be a great selling point for Scrivener with the science/engineering field IMO.

All of this is available via MultiMarkdown, isn’t it? I could be wrong, but I thought that this was exactly the sort of thing that MMD is good for. It would be very difficult for Scrivener to support such things natively because it uses rich text, and a lot of these tags are similar to the ones you would find in RTF. It would also be a lot of coding to add something that is already available via MMD (although I could stand to be corrected on that one if MMD doesn’t do what you want here).

All the best,
Keith

I tested the use of MMD->LaTeX. It is certainly a viable option to produce a working LaTeX document.

My concerns are two-fold. First, this requires (for me) learning a new (markDOWN) language. Secondly, the LaTeX encodings are controlled by MMD (ie, I have to edit them after the fact as needed).

Facing this and given the choice, I will likely dump a Scrivener document as ASCII text files and manually code the LaTeX commands than go through the above effort. Perhaps I am just showing a bit too much my age and inclination …

My apologies otherwise. Hopefully, my request for meta-tags as a way to help me in the process of producing a LaTeX document was not taken to suggest a disregard for Scrivener. In Authoring, Editing, and Designing (for RTF/MMD) an extensive document, Scrivener is certainly an efficient, intuitive, and “fun” tool to use! I respect that limiting its development to this focus will help keep it that way.

Thanks.

Because you don’t want to learn a second markup language (MMD), you are asking Keith to create a third one? I’m not sure I understand the logic there…

I’m also not sure I understand why you would have to code in the LaTex commands manually after exporting from Scrivener. Couldn’t you just include the LaTex commands in your Scrivener document as you write? They are just text symbols, after all…

Katherine

LaTeX code does not make it through the MMD->XHTML->LaTeX process. Some users have written scripts to do this (I believe Dr. Drang had something sort of similar).

For example, the raw text:

Test file \label{bob}

is formatted as:

Test file $\backslash$label{bob}

when run through MMD. But when it is seen in the final document by the user, it looks like:

Test file \label{bob}

Basically, MMD tries to make your output match your input, without the user having to think about special characters too much. The downside is that it makes it difficult to “pass-through” code for another language (e.g. LaTeX).

Since not everyone who uses MMD uses LaTeX, it would be a not insignificant question as to how to properly handle the concept of carrying code through the conversion process. There are a couple of ideas out there, but none have felt right to me yet. I am open to suggestions.

For now, you must manually tweak the LaTeX code, or write a custom script to do that for you (see my cleancites.pl script as an example).

Fletcher

Sorry, I wasn’t clear. My suggestion was to skip the MMD → XHTML step entirely, and simply code directly in LaTex within Scrivener. Export as ASCII when done.

This would put the user in complete control of all formatting, without recourse to nifty RTF shortcuts. It would also mean that the document could only be published through a LaTex-friendly venue, a limit that MMD is of course intended to avoid.

The original poster seemed willing to trade MMD’s convenience and flexibility for LaTex’s power (and familiarity, for him).

Katherine

Gotcha. It would mean a lot of redundant effort on the part of the user, but that is one way to do it.

I’m always curious to hear about what features people miss when authoring their LaTeX document in MMD. Sometimes it leads me to add a new feature, or at least a workaround. But after getting used to the ease of MMD->LaTeX, I’ll never handcode another LaTeX document again…

But I’m admittedly biased. :wink:

The ongoing comments to my orginal posting are much appreciated.

Admittedly, I have not evaluated the extent to which I will benefit by the “flexibility and convenience” of MMD for the final Design stage of the process. My intent has only been toward LaTeX output with encodings that are workable for me. In this regard, the use of \section{Overview} is far more “readable” to me when I reach the point of incorporating Design directives than is Overview (or whatever MMD uses …),. My limited testing of MMD->LaTeX also suggested that I will be re-editing the resultant LaTeX document anyway (so learning MMD was the redundant effort). As I become more informed about whether XHTML is an acceptable (and desired) format for publications within my field, I may reconsider my approach (for example, as I am learning, RTF is already becoming a far more dominate player than LaTeX in some cases).

Finally, as I understand now, my suggestion that Scrivener have a way to designate meta-tags on content can alternatively be taken as a request to allow users some method whereby they can exchange the RTF meta-tags for LaTeX/HTML/MMD/XML/… meta-tags during the document export process. A “plug-in” technology comes to mind.

I will look further into the recommended scripts and such that can handle LaTeX export from Scrivener.

Thanks.

With the exception of the fact that Scrivener is not really a LaTeX editor, I think it would actually make a pretty good LaTeX editor. What I mean is, the way it can cut up files and then assemble them into one document later would allow you to move preamble and other necessary clutter into separate documents, focussing more purely on the content. If you set it up right, you could even set up multiple export profiles with different preambles, enabling multiple purposing off of one base project. There are some interesting possibilities there. It wouldn’t be integrated like MMD is, but it certainly would not be clumsy.

Exactly!

When it comes to writing, LaTeX is NOT an Authoring or Editing tool - it is an exceptional Design and Printing tool. The existence of a good Authoring and Editing tool that integrates well with LaTeX is a dream for many who use LaTeX routinely. Those who use LaTeX routinely are likely to be more interested in how LaTeX coding is directly includable within Scrivener rather than how they have to “massage” Scrivener to output a document with LaTeX code (understand - this is not an assault on MMD, rather it is a statement about the barriers in the process to get LaTeX coding at the end).

I am by now convinced that Scrivener is exceptional as an Authoring and Editing tool for writing (manuscript type) documents. I see holes (barriers) in how it integrates with LaTeX as the companion tool for the backside of the process, and that is where my comments in this thread are directed.

Thanks!

All of which means that Scrivener is doing exactly what it was intended to do. Scrivener was designed as an authoring and editing tool for the first drafts of manuscripts of whatever kind. It was never, ever intended to integrate with LaTeX or any such thing. However, because it was easy to do and a few users wanted it, I integrated MMD for those who really wanted this sort of thing. But that is really as far as things go in Scrivener, or are ever likely to go.

All the best,
Keith

I think I have a solution that should be easier to implement than meta-tags.

First, I created a page with text. Then, I liberally included LaTeX coding as annotations. It actually was COOL because the LaTeX annotations were COLOR CODED in a way that did not distract from reading the document!

I then exported the page as TEXT. Here is the result:


Materials Overview
A study of materials should begin by describing what they are.
You have learned in a basic chemistry class that a substance is anything with mass. A material is a substance, in that it has mass; however, not all substances should necessarily be called materials.
[\centerfigwc[0.75]{substance}{%]
Ôøº
A material is a substance.[\]
Not all substances are materials.
[}]
We will address the following questions in this first chapter:
[\begin{itemize}]
[\item ]What distinguishes a material from a substance?
[\item ]What studies consider aspects of materials as part of their discipline?
[\item ]How are materials classified when they are used and studied?
[\end{itemize}]


Based on the output, here are my suggestions as a start toward a viable direct LaTeX export mode (rather than MMD->LaTeX) …

  1. Turn-off the [] braces around annotations
  2. For every paragraph, include an extra carriage return (to separate the paragraphs by a full line)
  3. Suppress export of images or other embedded stuff (my TEXT export had a funky glich sign at the point where I had embedded a PDF image)
  4. Make the file extension .tex rather than .txt

Now, for the “enhancements” to this …

  1. Somehow allow the user to pre-set export of TITLES to a page within the coding \chapter{TITLE}, \section{TITLE}, \subsection{TITLE}, \subsubsection{TITLE} …

This would lead to the following .tex file output:


\chapter{Materials Overview}

A study of materials should begin by describing what they are.

You have learned in a basic chemistry class that a substance is anything with mass. A material is a substance, in that it has mass; however, not all substances should necessarily be called materials.

\centerfigwc[0.75]{substance}{%
A material is a substance.\
Not all substances are materials.
}

We will address the following questions in this first chapter:

\begin{itemize}

\item What distinguishes a material from a substance?

\item What studies consider aspects of materials as part of their discipline?

\item How are materials classified when they are used and studied?

\end{itemize}


THIS is what would make me VERY HAPPY (or at least a bit less obnoxious :wink: )!!!

As a further note, it would be useful to have a way to Hide/Show Annotations while viewing the document.

Thanks!

On this one point, the way Scrivener will look in the next release was discussed heavily in this thread. Note that much of the beginning of the discussion is conceptual. If you go to the last few pages, you should find a link to a test program and screenshots of how things will look (I believe this poist is the most up to date)… Due to technical limitations, full hiding will not be available for some time (if ever), but we will be able to fade the intensity of footnote and annotation text to a user customised degree. While they will still occupy the same amount of space on the page, you will be able to diminish their visibility on a sliding scale from pure white (or whatever your paper colour is) to full original appearance.

Oh, and as for spacing out paragraphs automatically. Us MMD users already have to treat Scrivener like a text file. Insert the necessary breaks manually, and make sure that your document joining preferences are set to double break.

The fade out of annotations will be useful, especially for example if it can be adjusted manually for example to “off” (faded) at print and back to “on” at edit.

In the meantime, I have reminded myself how to get AppleScript + TextWrangler to remove the and add extra carriage returns in the exported Scrivener text file before I run LaTeX on it. So, annotations can serve as the “meta-tags” I want, albeit with some corrections needed afterward. (BTW, anyone who want to do direct HTML coding within Scrivener could use the same method).

The above option not withstanding, having something along the lines of a “RAW TEXT” export option in Scrivener to export contents as TEXT while 1) adding extra carriage returns at the end of paragraphs and 2) removing around annotations would be much appreciated. I would certainly promote such a development on the MacOS LaTeX listserver, where the use of a basic TextEditor seems to be the rule rather than the exception.

Thanks.

Hi,

You can already not print annotations if you don’t want to. Go to Page Setup, Settings, Scrivener, Text Options, and click on “remove annotations”. Your document prints as if the annotations weren’t there. Sweet. :smiley: