# How to document functions twice?

**URL:** <https://discourse.julialang.org/t/how-to-document-functions-twice/106816>\
**Category:** General Usage\
**Tags:** question, package, documenter\
**Created:** [November 27, 2023, 6:10pm UTC](https://discourse.julialang.org/t/how-to-document-functions-twice/106816 "2023-11-27T18:10:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 27, 2023, 6:10pm UTC](https://discourse.julialang.org/t/how-to-document-functions-twice/106816/1 "2023-11-27T18:10:31Z")

</div>

I want to refer to a function twice in my documentation, once I document the functions per file, and once per category. How can I achieve that?

If I refer to a function in two files like this:

````julia
```@docs
plot_cp
plot_four_ex2ep
.```

````

I get a “duplicate function definition” error.

If I try to refer to a definition in other file I get the following error:

```julia
 Error: reference for 'phase_shift()' could not be found in src/topics.md.

```

Yes, of course not, because it is defined in another file.

How can I solve this issue?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 27, 2023, 8:08pm UTC](https://discourse.julialang.org/t/how-to-document-functions-twice/106816/2 "2023-11-27T20:08:56Z")

</div>

This works:

```julia
[`phase_shift`](@ref)

```

No idea when back ticks are needed and when not.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 27, 2023, 9:33pm UTC](https://discourse.julialang.org/t/how-to-document-functions-twice/106816/3 "2023-11-27T21:33:12Z")

</div>

> [@ufechner7](#):
>
> No idea when back ticks are needed and when not

The [documentation](https://documenter.juliadocs.org/stable/man/syntax/#@ref-link) says:

> Text wrapped in backticks will cross-reference a docstring from a `@docs` block.

(Presumably the rationale here is that backticks are always used when quoting code.)

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 27, 2023, 9:43pm UTC](https://discourse.julialang.org/t/how-to-document-functions-twice/106816/4 "2023-11-27T21:43:19Z")

</div>

Well, I also need back-ticks for words that contain underscores etc, even if they don’t reference anything…

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 27, 2023, 9:45pm UTC](https://discourse.julialang.org/t/how-to-document-functions-twice/106816/5 "2023-11-27T21:45:08Z")

</div>

> [@ufechner7](#):
>
> Well, I also need back-ticks for words that contain underscores etc, even if they don’t reference anything…

Right, because you always use backticks in Markdown for code (and things that should be formatted like code, e.g. usernames `@ufechner7`). The point is that you _still_ use backticks when the code is a link to a cross-reference, not that cross-references are special in this regard.

(I’m not sure under what circumstance you would have a word containing a literal underscore that is _not_ code, but if you wanted this then you need to backslash-escape it in Markdown. For example, `underscore\_word` is formatted as underscore\_word.)
