# DocStringExtensions - interpolation string "$" allowed only in the preamble but not inside the structure

**URL:** https://discourse.julialang.org/t/docstringextensions-interpolation-string-allowed-only-in-the-preamble-but-not-inside-the-structure/40349
**Category:** General Usage
**Tags:** question, documentation, string-interpolation
**Created:** [May 28, 2020, 4:00pm UTC](https://discourse.julialang.org/t/docstringextensions-interpolation-string-allowed-only-in-the-preamble-but-not-inside-the-structure/40349 "2020-05-28T16:00:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yurier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yurier/32/15248_2.png) [@yurier](https://discourse.julialang.org/u/yurier)
#### Post date: [May 28, 2020, 4:00pm UTC](https://discourse.julialang.org/t/docstringextensions-interpolation-string-allowed-only-in-the-preamble-but-not-inside-the-structure/40349/1 "2020-05-28T16:00:19Z")

</div>

I would like to pass a function to some docstrings inside a structure (by using **$** ) not only in the preamble as in the example.

works without $ inside the structure

```julia
using Parameters, DocStringExtensions

"""
# My parameter preamble
These parameters are in use at $(pwd())...
# Fields
$(TYPEDFIELDS)
"""
@with_kw struct params
	# Parameters definition
	""" this is a Float"""
	a ::Float64	= 1.
end

```

output in Atom by typing **?params**

```julia
help?> params
search: params Parameters @pack_params @unpack_params partialsortperm partialsortperm!

  My parameter preamble
  ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  These parameters are in use at C:\Users\yrodrigu\synapse\Merge...
  Fields
  ≡≡≡≡≡≡≡≡
    • a::Float64
        this is a Float Default: 1.0

```

However, if **$(pwd())** is in a docstring inside the structure as in the example below an error message is shown.

```julia
using Parameters, DocStringExtensions

 """
 # My parameter preamble
 These parameters are in use at $(pwd()) ...
 # Fields
 $(TYPEDFIELDS)
 """
 @with_kw struct params
 	# Parameters definition
 	""" this is a Float $(pwd()) """
 	a ::Float64 = 1.
 end

```

ERROR MESSAGE:

```julia

Closest candidates are:
decolon2(!Matched::Symbol) at C:\Users\yrodrigu\.julia\packages\Parameters\l76EM\src\Parameters.jl:102
decolon2(!Matched::Expr) at C:\Users\yrodrigu\.julia\packages\Parameters\l76EM\src\Parameters.jl:101
in expression starting at C:\Users\yrodrigu\synapse\Merge\params_synapse.jl:522
in expression starting at C:\Users\yrodrigu\synapse\Merge\params_synapse.jl:513
in @doc at [base\boot.jl:461](#)
in at [DocStringExtensions\BEyNH\src\templates.jl:11](#)
in docm at [base\docs\Docs.jl:509](#)
in docm at [base\docs\Docs.jl:509](#)
in macroexpand at [base\expr.jl:106](#)
in #macroexpand#32 at [base\expr.jl:107](#)
in @with_kw at [Parameters\l76EM\src\Parameters.jl:631](#)
in with_kw at [Parameters\l76EM\src\Parameters.jl:442](#)

```

---

<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: [May 28, 2020, 4:39pm UTC](https://discourse.julialang.org/t/docstringextensions-interpolation-string-allowed-only-in-the-preamble-but-not-inside-the-structure/40349/2 "2020-05-28T16:39:39Z")

</div>

You can use `@doc "...." object` to have more control over the documentation string (which, in fact, can be an arbitrary object), including to do interpolation into the string.

---

<div class="post-metadata">

### Author: ![yurier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yurier/32/15248_2.png) [@yurier](https://discourse.julialang.org/u/yurier)
#### Post date: [May 29, 2020, 11:34am UTC](https://discourse.julialang.org/t/docstringextensions-interpolation-string-allowed-only-in-the-preamble-but-not-inside-the-structure/40349/3 "2020-05-29T11:34:39Z")

</div>

thanks!
