Scrivener annotation to Latex footnote, index, margin note

If you want to use colored Scrivener annotations to generate LaTex index, footnotes, and margin notes, this might help. To change annotation colors, create the annotation and do Cmd-Sh-C to open the color palette.

Following posts by Amber and signinstranger, I trivially modified what they had posted, and now I have easy Scrivener to LaTex footnotes, index, margin notes, and (private) notes to self. Insert this into memoir.xslt, right below the last <xsl:template match=…>

<!-- Scrivener Annotation Colors : from Apple palette -->   
<xsl:variable name="sc_FOOTNOTE" select="'0000FF'"/> 	<!-- blue -->
<xsl:variable name="sc_INDEX" select="'996633'"/>      <!-- brown -->
<xsl:variable name="sc_NOTE_TO_SELF" select="'FF0000'"/>   <!-- red -->
<xsl:variable name="sc_MARGIN" select="'FF00FF'"/>   <!-- magenta -->

<xsl:template match="html:span[starts-with(@style,'color:')]">
   <xsl:variable name="ann_text" select="node()"/>
   <xsl:variable name="ann_color" select="@style"/>  <!-- ann_color=color:FF0000 -->
   <xsl:choose> 
     <xsl:when test="contains($ann_color, $sc_FOOTNOTE)">
	   <xsl:text>\footnote{</xsl:text>   <xsl:value-of select="$ann_text"/>   <xsl:text>}</xsl:text>
     </xsl:when> 
     <xsl:when test="contains($ann_color, $sc_INDEX)">
	   <xsl:text>\index{</xsl:text>   <xsl:value-of select="$ann_text"/>   <xsl:text>}</xsl:text>
     </xsl:when> 
     <xsl:when test="contains($ann_color, $sc_NOTE_TO_SELF)">
     </xsl:when> 
     <xsl:otherwise>      <!-- sc_MARGIN or anything else -->
	   <xsl:text>\marginpar{\small </xsl:text>   <xsl:value-of select="$ann_text"/>   <xsl:text>}</xsl:text>
     </xsl:otherwise>
   </xsl:choose>
</xsl:template>

Thanks, I’m sure this will be useful to quite a few. I did have one question: why are you creating a separate class of annotation for footnotes? Why not just use Scrivener’s footnote tool? These get automatically converted to LaTeX footnotes already, and it saves a step of recolouring.

Mistaken assumption on my part, thanks for the info!