# Write id for code block to label attr in latex when listing is used #961

Merged
merged 1 commit into from Aug 26, 2013

## Conversation

Projects
None yet
2 participants
Contributor

### nougad commented Aug 22, 2013

 The code: ~~~{#test} asdf ~~~  gets compiled to html: 
asdf
 So it is possible to link to the identifier test But this doesn't happen on latex When using the listings package (--listings) it is possible to set the identifier using the label=test property: \begin{lstlisting}[label=id] hi \end{lstlisting}  And this is exactly what this patch is doing. Modified LaTeX Reader/Writer and added tests for this.
 Write id for code block to label attr in latex when listing is used 
The code:

~~~{#test}
asdf
~~~

gets compiled to html:

<pre id="test">
asdf
</pre>

So it is possible to link to the identifier test

But this doesn't happen on latex

When using the listings package (--listings) it is possible to set the
identifier using the label=test property:

\begin{lstlisting}[label=id]
hi
\end{lstlisting}

And this is exactly what this patch is doing.

Modified LaTeX Reader/Writer and added tests for this.
 5f09cf7 

### jgm commented on 5f09cf7Aug 26, 2013

 Nice patch, tests much appreciated!

### jgm added a commit that referenced this pull request Aug 26, 2013

 Merge pull request #961 from nougad/add_latex_listings_label 
Write id for code block to label attr in latex when listing is used
 e7a4bcc 

### jgm merged commit e7a4bcc into jgm:master Aug 26, 2013 1 check passed

#### 1 check passed

default The Travis CI build passed
Details