# Julia code with references (Latex style). Can I write a code and a paper in one file?

**URL:** <https://discourse.julialang.org/t/julia-code-with-references-latex-style-can-i-write-a-code-and-a-paper-in-one-file/31015>\
**Category:** General Usage\
**Created:** [November 12, 2019, 6:19pm UTC](https://discourse.julialang.org/t/julia-code-with-references-latex-style-can-i-write-a-code-and-a-paper-in-one-file/31015 "2019-11-12T18:19:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [November 12, 2019, 6:19pm UTC](https://discourse.julialang.org/t/julia-code-with-references-latex-style-can-i-write-a-code-and-a-paper-in-one-file/31015/1 "2019-11-12T18:19:11Z")

</div>

Is it possible to include in the code file reference to papers or other code lines? So can I write code and include a latex command like \citet \eq and others.

I would be helpful to comment code.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [November 13, 2019, 12:00am UTC](https://discourse.julialang.org/t/julia-code-with-references-latex-style-can-i-write-a-code-and-a-paper-in-one-file/31015/2 "2019-11-13T00:00:14Z")

</div>

You can reference some things like code etc. if you’re using Documenter  
[https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@ref-link-1](https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@ref-link-1)  
I’m not exactly sure what you want though, for latex to run through your code and find latex references?

---

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [November 13, 2019, 4:32pm UTC](https://discourse.julialang.org/t/julia-code-with-references-latex-style-can-i-write-a-code-and-a-paper-in-one-file/31015/3 "2019-11-13T16:32:36Z")

</div>

I wonder about next two futures:

1. in comment have ability to cite some papers. For instance: "here we use the number from \citet{boroner1974}.  
1.1) As result, there have to be reference block somewhere
2. I would like to comment cite to other line of code: For instance: "Additional explanation can be found \ref{…}. OR "Here we use this equation: \ref

To sum up, I would like that comments would be like latex document, since a lot of people use Julia for research computations, it would be very helpful.  
In additional, it would be great to write a code and a paper in one file.

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [November 13, 2019, 5:06pm UTC](https://discourse.julialang.org/t/julia-code-with-references-latex-style-can-i-write-a-code-and-a-paper-in-one-file/31015/4 "2019-11-13T17:06:13Z")

</div>

I might be mistaken, but what you describe sounds a lot like “Literate Programming” ; have you looked at packages providing such features? The two names that come to mind are:

- [Weave.jl](https://github.com/JunoLab/Weave.jl)
- [Literate.jl](https://github.com/fredrikekre/Literate.jl)
