[Question]
  [
In the burial place of King Silo of Asturias there is an inscription that reads **SILO PRINCEPS FECIT** (*King Silo made this*).
![SILO PRINCEPS FECIT](https://upload.wikimedia.org/wikipedia/commons/3/32/Silo_princeps_fecit.JPG)
The first letter is found in the very middle, and from there one reads by going in any non-diagonal direction radiating outward. The final letter is found on all four corners. In this challenge, you'll generalize the process to make them.
## Input
A string ([or equivalent](https://codegolf.meta.stackexchange.com/questions/2214/whats-a-string/2216)), and an integer. You may make the following assumptions about the input:
* The string will have an odd length.
* The integer will be an odd number between 1 and one less than twice the length of the string.
## Output
An *inscriptio labyrinthica* for the string, using the integer for the height *or* width (see models for height examples). Output should be each letter with no spaces, line break as default to your system/language.
## Test cases
Note that an input of 1 or (length \* 2 - 1) will result in a horizontal or vertical palindrome.
```
 Input: FOO, 3    Input: BAR, 1    Input: BAR, 3    Input: BAR, 5
Output: OOO      Output: RABAR    Output: RAR       Output: R
        OFO                               ABA               A
        OOO                               RAR               B
                                                            A
                                                            R
 Input: ABCDE, 5   Input: ABCDE, 3   Input: *<>v^, 5
Output: EDCDE     Output: EDCBCDE           ^v>v^
        DCBCD             DCBABCD           v><>v
        CBABC             EDCBCDE           ><*<>
        DCBCD                               v><>v
        EDCDE                               ^v>v^
```
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so shortest answer in bytes wins. [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) forbidden.
  
[Answer]
# [J](http://jsoftware.com/), 27 bytes
```
([{~]+/&(|@i:)#@[-1+])-:@<:
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NaKr62K19dU0ahwyrTSVHaJ1DbVjNXWtHGys/mtycaUmZ@QrqLv5@6srpCkYQ7nqUNrJMQgkbIhd2BRN2NHJ2cUVr4TxfwA "J – Try It Online")
An example will clarify the high-level approach.
Consider `'ABCDE' f 3`
We notice that what we seek is simply the "cross addition" table of `1 0 1` and `3 2 1 0 1 2 3`, which looks like this:
```
4 3 2 1 2 3 4
3 2 1 0 1 2 3
4 3 2 1 2 3 4
```
We then pull those indexes from the original string: `[{~`.
All the rest of the code is just boring arithmetic and the use of `i:` to construct the arguments `1 0 1` and `3 2 1 0 1 2 3`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 12 bytes
```
Uṡṛ‘HɗŒBŒḄZY
```
[Try it online!](https://tio.run/##y0rNyan8/z/04c6FD3fOftQww@Pk9KOTnI5OerijJSryv/Wjhrk61o8adwLxdmufRw0zPY51PWrcVnFyOlBqTtmhbUAF1oeXA6X3Hdp2aBvX4eWPNq7T5zrc/qhpzf//0dFKbv7@SjrRxrGxOtFKTo5BQLahjrGOKZjv6OTs4goUMdWByGvZ2JXFwVUHe/r4BwR5@jm7BgS7uTp7hoD0AjXG/gcA "Jelly – Try It Online")
A dyadic link taking the string as its left and height as its right argument. Returns a string with line breaks. If a list of strings were acceptable for output, I can remove the final `Y` saving a byte. Interestingly the original “SILO PRINCEPS FECIT” looks to me like ASCII art of a 3D diamond when I look at it on TIO. 
## Explanation
```
U            | Reverse input
 ṡ   ɗ       | All overlapping substrings of the length given by:
  ṛ          | - The right argument
   ‘         | - Incremented by 1
    H        | - Halved
      ŒB     | Concatenate to the reverse, keeping a single copy of the last character (so creating a palindrome)
        ŒḄ   | Do the same, but this time using the lists of characters generated by the last atom
          Z  | Transpose
           Y | Join with newlines
```
[Answer]
# [R](https://www.r-project.org/), ~~93~~ ~~91~~ 87 bytes
-2 bytes thanks to Giuseppe. 
-4 bytes by inputting the width rather than the height, as allowed by OP.
```
function(s,W,w=W%/%2,h=length(s)-w-1)write(s[1+outer(abs(-w:w),abs(-h:h),`+`)],1,W,,"")
```
[Try it online!](https://tio.run/##bY7RCoJAEEXf@4pYEHZyJCwikgzKDIKoqMCHKCzRFEJBrf18G7f1QfDhwO6Zu3cnryK7ij5pUCZZygv0UNieNtRGGNvvMH2VMS/AEIYJIk/KkBdXU88@ZZjzx7PghrAEoDzFVgzo6z7c0KQWZAyqiAecbRiygwSwP4ZeT9oVmSVxqu2k03ZnzcbWpp44xJpwW02d02kzHZCZEwviS9xbb89ktsRObX6Uf//dXnW6ytfZjbo7KnORe86g@gE "R – Try It Online")
Takes input as a vector of characters. The key part is `s[1+outer(abs(-w:w),abs(-h:h),'+')]`.
First compute \$w\$ and \$h\$ such that the output is of size \$(2w+1)\times(2h+1)\$.
In the output, we want the character in position \$(i,j)\$ to be the character at index \$1+|i-h|+|j-w|\$ in the input. This corresponds to the outer sum of `abs(-w:w)` and `abs(-h:h)` (`abs(-h:h)` is a short way of writing the vector \$[h, h-1, h-2, \ldots, 2, 1, 0, 1, 2, \ldots, h-1, h]\$). For instance, `outer(abs(-2:2), abs(-1:1), '+')` gives 
```
32123
21012
32123
```
(we then need to add 1 because R is 1-indexed.) The 0 in the centre is where the first letter of the input should go.
The rest is formatting.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~25~~ 19 bytes
```
Ｅ⊘⊕η✂θι⁺ι⁻Ｌθ⊘⊖η‖Ｏ←↑
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM3sUDDIzGnLDVFwzMvuSg1NzWvBMjO0NTUUQjOyUxO1SjUUcjUUQjIKS3WANK@mXlAhk9qXnpJhkYhUBFUs0sqimYQsOYKSk3LSU0u8S9LLcoB2mPlk5pWoqNgFVqgaf3/v6OTs4srl/F/3bIcAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
Ｅ⊘⊕η✂θι⁺ι⁻Ｌθ⊘⊖η
```
Draw a quarter of the inscription.
```
‖Ｏ←↑
```
Reflect to complete the inscription.
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-R`](https://codegolf.meta.stackexchange.com/a/14339/), ~~19~~ 16 bytes
```
z
ò@VÔtXUaVÊ)êÃê
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LVI&code=egryQFbUdFhVYVbKKerD6g&input=MTUKIlNJTE9QUklOQ0VQU0ZFQ0lUIg)
```
z\nò@VÔtXUaVÊ)êÃê     :Implicit input of integer U & string V
z                     :Floor divide U by 2
 \n                   :Reassign result to U
   ò                  :Range [0,U]
    @                 :Map each X
     VÔ               :  Reverse V
       tX             :  Substring from index X to index ...
         Ua           :    Absolute difference between U and ...
           VÊ         :    Length of V
             )        :  End substring
              ê       :  Palindromise
               Ã      :End map
                ê     :Palindromise
                      :Implicit output, joined by newlines
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~57~~ 54 bytes
```
(g=Reverse@Rest@#~Join~#&)@BlockMap[g,#,⌈#2/2⌉,1]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7XyPdNii1LLWoONUhKLW4xEG5zis/M69OWU3TwSknPznbN7EgOl1HWedRT4eykb7Ro55OHcNYtf8arskZ@Q7KytYBRZl5JfoOadHOGYlFicklQJMclHWUjWI11RwcHKq5qpXc/P2VdIxrdYBMJ8cgJR1TBBNJ1BDMdHRydnGFKYFyzMEcLRu7sjiQDFftfwA "Wolfram Language (Mathematica) – Try It Online")
Takes the width as input.
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-R`](https://codegolf.meta.stackexchange.com/a/14339/), 10 bytes
```
Ôã°Vz)mê ê
```
Takes width instead of height.
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LVI&code=1OOwVnopbeog6g&input=IlNJTE9QUklOQ0VQU0ZFQ0lUIgoxOQ)
Pseudocode (U is string, V is integer):
```
U.Reverse().AllSubstringsOfLength(++V / 2).Map(Palindromize).Palindromize
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~68~~ 67 bytes
```
{say |$^a.comb[{$_...0...$_}($a.comb-$^b+>1-1)X+.abs]for ^$b-$b+>1}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/ujixUqFGJS5RLzk/Nym6WiVeT0/PAIhV4ms1VCCiuipxSdp2hrqGmhHaeolJxbFp@UUKcSpAcZBw7X8gl0tD3c3fQF1HwVhTB8h2cgwCsg2R2MjipmC2o5OziysGD6JOy8auLA4uF@zp4x8Q5Onn7BoQ7Obq7BkCMttUk6uaizNNo0YlXtOai7OgKDOvREEpJk/Jmqv2PwA "Perl 6 – Try It Online")
[Answer]
# Python 3, 104 bytes
I haven't golfed in so long... I'm sure this could be shorter.
## Details
This code defines a function that takes two arguments (the string and the height) and gives the result on standard output.
The index into the string is the Manhattan distance from the centre of the grid. For a grid of width `w` and height `h`, the distance for the cell at `(x, y)` is `abs(x - (w - 1) / 2) + abs(v - (h - 1) / 2)`.
The width of the grid must be such that the Manhattan distance of the corners (say, `(0, 0)`) is one less than the length of the string. Substituting `(0, 0)` into the above and simplifying, we find that the width is simply `2 * len(s) - h`.
## Code
```
def b(s,h):
 w=2*len(s)-h
 for y in range(h):print(''.join(s[abs(x-w//2)+abs(y-h//2)]for x in range(w)))
```
[Try it online!](https://tio.run/##K6gsycjPM/7/PyU1TSFJo1gnQ9OKS6Hc1kgrJzVPo1hTN4NLIS2/SKFSITNPoSgxLz1VA6iioCgzr0RDXV0vKz8TqCo6MalYo0K3XF/fSFMbxK7UzQCxY0E6KxA6yzU1Nf8naSi5@fsr6SgYa3JBzNHkAoo5OQYBxQyxiGFTZ4oi5ujk7OKKUxRVv5aNXVkchtpgTx//gCBPP2fXgGA3V2fPEJBbTDX/AwA "Python 3 – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 10 bytes
```
RŒI>;ù€ûû»
```
[Try it online!](https://tio.run/##ASIA3f9vc2FiaWX//1LFkkk@O8O54oKsw7vDu8K7//9BQkNERQoz "05AB1E – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 19 bytes
```
L+_btbjyyM.:Q-lQ/E2
```
[Try it online!](https://tio.run/##K6gsyfj/30c7PqkkKauy0lfPKlA3J1Df1ej/f6VgTx//gCBPP2fXgGA3V2fPECUuQ1MA "Pyth – Try It Online")
```
L+_btbjyyM.:Q-lQ/E2   Implicit: Q=string, E=height
L                     Define a function, y(b):
  _b                    Reverse b
 +  tb                  Append all be first element of b
                      y is now a palindromisation function
              lQ      Length of Q
             -  /E2   Subtract floored division of E by 2
          .:Q         All substrings of Q with the above length
        yM            Palindromise each substring
       y              Palindromise the set
      j               Join on newlines, implicit print
```
[Answer]
# [Python 2](https://docs.python.org/2/), 95 bytes
```
def f(s,n):
 y=len(s);n//=2
 for i in range(n+1)+range(n)[::-1]:print s[y+~i:n-i:-1]+s[n-i:y-i]
```
[Try it online!](https://tio.run/##tYpNDoIwEEb3c4pZthZCgLCpYuLvlgMQNCRSncQMpEVNN169SnThBdy9971v8OOl5yyEU2fQCBex1IC@vHYsnJxzkpQZoOktEhKjbfncCVapVF@UtdZx2ujBEo/oaq@epDmmaVSunsjH1AQjbPs4Eg@3Ucjo/f11KeHPPazWm@0OCthXFeTwsRxmi@X9EEHxAg "Python 2 – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), ~~11~~ 9 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
é─C[┬«#t▒
```
[Run and debug it](https://staxlang.xyz/#p=82c4435bc2ae2374b1&i=3,+%22FOO%22%0A5,+%22BAR%22%0A1,+%22BAR%22%0A3,+%22ABCDE%22%0A5,+%22ABCDE%22&a=1&m=2)
It takes the width, and the original string, in that order.
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 146 bytes
```
s=>n=>{int w=s.Length*2-n,i=0,j;var r=new char[n,w];for(;i<n;i++)for(j=0;j<w;)r[i,j]=s[System.Math.Abs(n/2-i)+System.Math.Abs(w/2-j++)];return r;}
```
[Try it online!](https://tio.run/##dVDRasIwFH3vV1z2lM7aVd9GmsIQHYJuMgd7KH3IaqwpegtJtIj47V1q3Ww3dh8Scu65J/ecVPfTQokq3XKtYaGKTPGdc3LAljbcyBSU4KsCt0dYHrURO3@yxzTURknMvA4m0XiQbriKvSSKYA2s0ixCFp1sB0qm/ZnAzGzuh330JAu8nB64AsVQlM0cemVC14UiVIZIZa/n1o@cBTQPS@qqWHp5wnR8/XXOzcZ/@tQEH4Z96fZ@w6WFcyuSUCXMXiEoeq6o0zZ3KOQK5lwiaRzFCXCVaffCaWKoq94TgcHgkXYwbbG75XT2Cou36ctovFjCZDyavt91aUrUxDXRLkH31rLmgNTZSNsNqL3Cmuo/C9MkRQLXotbBz8htpY5A3gjkfwQGViBvC3zXNatRgbrYCv9DSSOInb1E3NrxP@5MoiAt3tlpznP1BQ "C# (.NET Core) – Try It Online")
Longest answer so long. :-) It uses the Manhattan distance to the center of the square. There must be a shorter way, though.
[Answer]
# [Tcl](http://tcl.tk/), ~~188~~ ~~170~~ 162 bytes
```
{{w s} {join [lmap C [lrepeat $w string] {join [$C reverse [set y [$C range $s [set x [expr abs($w/2+1-[incr i])]] end-[expr $w/2-$x]]]][$C range $y 1 end]}] \n}} bytes
```
[Try it online!](https://tio.run/##bYzBisIwGITvPsVYcnDVIt1lD4IIWhf2DTykWcjqr1RiGpJoW0qevbYUYVmcy8B8H@MPqnXkcULWNk0JF9BcilyDq6s0SLu2ZEh6sA56m@uzeBoshaU7WUfg/Uc9TFKfCcwNWwVOlbGQv27CysX7LIl5rg8WuXgTAqSP8SD0MGaV6PLnpUbSOyIIZDqE1ty8Q8SlMaoGO@ED0TcpVcyxL6w6jiMRjf47n5iu1vefFyTBZpvuvl6Q5ZO0Dw "Tcl – Try It Online")
There seem to be a million bad ways to golf this problem in TCL. This is not the worst of them.
Saved 18 bytes minimum by converting to lambda (can save up to 13 more if return value of a list of lines is acceptable)
Saved an additional 8 since lmap iterator served as an extra constant
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 18 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
±Ｘ↕┌Ｌ╵┌－Ｙ｛ｘ；１ｙ１＠］┼
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JUIxJXVGRjM4JXUyMTk1JXUyNTBDJXVGRjJDJXUyNTc1JXUyNTBDJXVGRjBEJXVGRjM5JXVGRjVCJXVGRjU4JXVGRjFCJXVGRjExJXVGRjU5JXVGRjExJXVGRjIwJXVGRjNEJXUyNTND,i=U0lMT1BSSU5DRVBTRkVDSVQlMEExNQ__,v=8)
Canvas doesn't do substrings, so I need to treat it like an art object and get a subsection that way. I feel like this costs me 2 bytes, but hey, what can you do.
Looks like this actually doesn't work like I thought: Canvas's palindromize functions mirror certain characters (e.g. V mirrored vertically becomes ^), and I can't exactly disable that... oh well, i guess
[Answer]
# [Ruby](https://www.ruby-lang.org/), 65 bytes
```
->s,h{(-(h/=2)..h).map{|y|(z=s[(w=y.abs)..w+~h]).reverse.chop+z}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf165YJ6NaQ1cjQ9/WSFNPL0NTLzexoLqmskajyrY4WqPctlIvMakYKFOuXZcRq6lXlFqWWlScqpeckV@gXVVb@7@gtKRYIS1aydHJ2cXVzd3D08tbSUfB0DT2PwA "Ruby – Try It Online")
]