g | x | w | all
Bytes Lang Time Link
717Bespoke250817T210448ZJosiah W
2676250321T070833ZUsed_Bra
020J240424T210247ZJonah
140Tcl170617T161231Zsergiol
108sed rn240414T155458Zguest430
940jbasher2241212T163843Zmadeforl
018K ngn/k240906T205555Zcoltim
073Raku Perl 6 rakudo240719T070029Zbb94
193Go240501T202352Zbigyihsu
022Pip l240515T222338ZDLosc
111YASEPL240410T140639Zmadeforl
150Rust240501T193800ZDornteuf
059Perl 5 n240424T204431ZXcali
078Perl 5 + M5.10.0 pla240424T195750ZDom Hast
021Uiua SBCS240406T211105Zchunes
01505AB1E240408T104358ZKevin Cr
276brainfuck210216T093327ZRezNesX
025APL Dyalog170609T124355ZAdá
083Zsh210213T122524Zpxeger
223///210213T020458ZSamuel W
104C170609T103830Zanatolyg
085C gcc170623T085656ZGiacomo
003Canvas180405T200052Zdzaima
072R170608T211145ZGiuseppe
02105AB1E170608T200649ZMagic Oc
017Jelly170609T021424Zfireflam
066Ruby170608T204318ZValue In
201TSQL170609T200939ZBradC
014Pyke170609T190256ZBlue
135Java OpenJDK 8170609T165540ZPunPun10
150C170608T194511ZMD XF
084Python 2170608T202320Zovs
138Bash170609T132050Zmarcosm
071Mathematica170609T120821ZNot a tr
016MATL170608T183425ZLuis Men
120C#170608T203325ZLiefdeWe
02205AB1E170609T090505ZEmigna
450Visual Basic.Net170608T211849Zpolyglot
079JavaScript ES6170608T190258ZArnauld
131Mathematica170608T205628ZZaMoC
074Retina170608T210041ZNeil
081Python 2170608T213714Zxnor
090QBIC170608T185410Zsteenber
115PHP170608T203000ZJör
nanPerl 5170608T202855ZChris
111shortC170608T200744ZMD XF
201Batch170608T200106ZNeil
021V170608T182709ZDJMcMayh
006Charcoal170608T182441ZOkx

Bespoke, 717 bytes

INPUT N
DO COPY
DO COPY
CONTROL WHILE
PUSH BI DO COPYN
DO COPY
DO COPY
STACKTOP PLUS
STACKTOP PLUSONE
CONTROL DOWHILE
PUT XX:FOUR SEVENTH
PUSH FOUR DO COPYN
PUSH FOUR DO COPYN
STACKTOP PLUS
CONTROL IF
DO P
PUT XX:TRI BI
CONTROL END
PUSH FOUR DO COPYN
PUSH FOUR DO COPYN
STACKTOP MINUS
STACKTOP F
CONTROL IF
DO P
PUT XX:DIGITNINE BI
CONTROL END
DO COPY
OUTPUT CH
PUSH FIFTH DO ROT
DO SWITCH
STACKTOP MINUSONE
DO SWITCH
STACKTOP MINUSONE
DO COPY
CONTROL END
H SV
PUT XX:I NUMBERZERO
DO COPY
OUTPUT CH
PUSH TRI DO ROT
STACKTOP MINUSONE
DO COPY
CONTROL END
DO P
DO COPY
CONTROL WHILE
PUT XX:TRI BI
DO COPY
OUTPUT CH
DO SWITCH
STACKTOP MINUSONE
DO COPY
CONTROL END
PUT XX:INTEIGHT INTEIGHT
CONTROL DOWHILE
OUTPUT CH
PUSH I

Prints the slash with trailing spaces (such that the lines are the same length), and no trailing newline.

For each character in the upper half of the slash, I rotate it into the stack, so that once I reach the middle X, I'm able to print the lower half of the slash by simply printing the rest of the items on the stack in order.

Alternate version, 721 bytes

CONTROL FUNCTION X:I
DO COPY
CONTROL WHILE
PUT XX:TRI BI;OUTPUT CH
STACKTOP MINUSONE
DO COPY
CONTROL END
DO P
OUTPUT CH
CONTROL END
CONTROL FUNCTION X:BI
PUSH TRI DO COPYN
CONTROL CALL X:I
PUSH TRI DO COPYN
PUSH TRI DO COPYN
STACKTOP MINUS
DO COPY
STACKTOP PLUS
STACKTOP MINUSONE
CONTROL CALL X:I
PUT XX:I NUMBERZERO;OUTPUT CH
CONTROL END
INPUT N
PUSH I H V
PUSH BI DO COPYN
CONTROL WHILE
PUT XX:FOUR SEVENTH
PUT XX:DIGITNINE BI
CONTROL CALL X:BI
STACKTOP PLUSONE
DO COPY
PUSH TRI DO COPYN
STACKTOP LT
CONTROL END
DO P
PUT XX:INTEIGHT INTEIGHT
PUSH BI DO COPYN
CONTROL CALL X:I
PUT XX:I NUMBERZERO;OUTPUT CH
DO COPY
DO COPY
CONTROL WHILE
STACKTOP MINUSONE
PUT XX:DIGITNINE BI
PUT XX:FOUR SEVENTH
CONTROL CALL X:BI
DO COPY

Prints the slash with no trailing spaces and a trailing newline.

I couldn't come up with a way to golf either approach further. I'm not entirely sure which one would end up being better.

, 26 chars (76 bytes)

Solution

󷺹󷸹~⟞⊞²ᐵᐖ‹X/\ ›􍪴􊮪􊪫₂􍭚􍭠􊹳ᐸ⨁ᐸ⨝𝗻

Note: ☾ uses a custom font, but you can run this code in the Web UI

DiagramExtra

J, 25 20 bytes

' /\X'{~(|.++~)@=@i:

Try it online!

-5 thanks to Galen!

Arrived at independently, but very similar approach to Adam's APL answer. J has a primitive = that returns the identity matrix when given a list of distinct number, making that part even shorter.

Tcl, 140 bytes

proc P {x s b} {time {puts [format %[incr ::i $x]s%[expr ($::argv-$::i)*2+2]s $s $b]} $::argv}
P 1 \\ /
puts [format %[incr i]s X]
P -1 / \\

Try it online!

May be I can golf it more using a recursive approach

sed -rn, 112 111 108 bytes

s/^0/X/p;t
s/.*/echo {0..&}/e
s/[^ ]//g
s%.*%\\&&/%
s/ //p
:a
h;s%\\ /% X%p;x
s%(\\)? (/)?%\2 \1%gp
/^\//!ba

Try it online!

basically a port of my sed answer to another challenge (see explanation there) which uses the engine from this answer

jbasher2, 940 bytes

create i with type number
create m with type number
ask for input
parse that as int
set that to m
create n with type number
set 1 to n
create u with type number
set m to u
create l with type number
set 2 to l
while l > 0
if u > 0
if l > 1
create f with type string
set "/" to f
create b with type string
set "\" to b
endif
create t with type number
set 1 to t
while t > 0
repeat " " an i amount of times
output inline that
output inline b
subtract u by i
multiply that by 2
subtract that by 1
repeat " " an that amount of times
output inline that
output f
add n by i
set that to i
if l > 1
if i >= m
set 0 to t
endif
endif
if l < 2
if i <= m
set 0 to t
endif
endif
endwhile
endif
subtract i by 1
set that to i
subtract l by 1
set that to l
if l > 0
repeat " " an m amount of times
output inline that
output "X"
if m > 0
subtract 0 by 1
set that to m
set m to n
create e with type string
set b to e
set f to b
set e to f
endif
endif
endwhile

woot

(edit: i got the bytecount wrong)

K (ngn/k), 19 18 bytes

-1 byte from @att

"X\\/"@2/~|:\=1+2*

Try it online!

Thanks to @tubular.

Raku (Perl 6) (rakudo), 85 73 bytes

{for $_ ->\y {say [~] .map({' \\/X'.comb[2*!(y+$_)+(y==$_)]})}}o{-$_..$_}

Attempt This Online!

Go, 199 193 bytes

import."strings"
func f(n int)(s string){S,R:=" ",Repeat
for i:=range n{s+=R(S,i)+`\`+R(S,max(0,2*(n-i)-1))+`/
`}
s+=R(S,n)+`X
`
for i:=range n{s+=R(S,n-i-1)+`/`+R(S,max(0,2*i+1))+`\
`}
return}

Attempt This Online!

Pip -l, 22 bytes

YEYa*2+1(" /\X"y*2+Ry)

Try It Online!

Explanation

YEYa*2+1(" /\X"y*2+Ry)­⁡​‎‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁡⁣‏⁠‎⁡⁠⁢⁡⁤‏⁠‎⁡⁠⁢⁢⁡‏‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁣⁡‏⁠‎⁡⁠⁢⁢⁢‏‏​⁡⁠⁡‌⁢⁣​‎‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏‏​⁡⁠⁡‌­
   a*2+1                ; ‎⁡Twice the argument plus 1
 EY                     ; ‎⁢Identity matrix of that size
Y                       ; ‎⁣Yank into y
               y*2      ; ‎⁤Multiply each number in y by 2
                  +Ry   ; ‎⁢⁡Add y reversed
                        ; ‎⁢⁡We now have a 2D array containing 2s on the main diagonal,
                        ; 1s on the main antidiagonal, 3 at the intersection,
                        ; and 0s elsewhere
        (            )  ; ‎⁢⁢Use that array as a (multi-)index into
         " /\X"         ; ‎⁢⁣this string
                        ; ‎⁢⁣Join each row and output them newline-separated (-l flag)
💎

Created with the help of Luminespire.

YASEPL, 114 111 bytes

=i!m'!n$!u$m]2!f$47»!b$92»!l$+`1!o;" ",i~#b$u-i*-;" ",o~>f!i+n}l,m-`2!n[3--!o;" ",m~>"X"!m]3=m-!l$!b)f!f$92»|`3

explanation (poor)

=i!m'!n$!u$m]2!f$47»!b$92»!l$+`1!o;" ",i~#b$u-i*-;" ",o~>f!i+n}l,m-`2!n[3--!o;" ",m~>"X"!m]3=m-!l$!b)f!f$92»|`3         packed
=i                                                                                                                      increment variable
  !m'                                                                                                                   input 
     !n$                                                                                                                N = 1
        !u$m                                                                                                            U = M
            ]2                                                     `2                                                   If U != 0 ...
              !f$47»!b$92»                                                                                                F = "/", B = "\"
                          !l$+                                                                                            set L to 2
                              `1                          !i  }l,m                                                        while (L == 2 and I < M) xor (L == 1 and I > M) ...
                                !o;" ",i~                                                                                   write a space I amount of times (inline)
                                         #b                                                                                 write B (inline)
                                           $u-i*-;" ",o~                                                                    write a space [U - I] * 2 - 1 amount of times (inline)
                                                        >f                                                                  print F with newline at end
                                                            +n                                                              add N to I and loop.
                                                                  -                                                     decrement I
                                                                     !n[3                                    `3         If N == 1 ...
                                                                         --                                               subtract 2 from N
                                                                           !o;" ",m~>"X"                                  write a space M amount of times inline and an X with newline
                                                                                        !m]3                 `3           if M != 0 ...
                                                                                            =m-                             set M to -1
                                                                                               !l$                          set L to 1
                                                                                                  !b)f!f$92»                swap B and F
                                                                                                            |               loop back to 1 and  print other half

Rust, 150 bytes

|n|{let w=|e|" ".repeat(e);for i in 0..n{print!("{}\\{}/
",w(i),w(2*n-2*i-1))}print!("{}X
",w(n));for i in 0..n{print!("{}/{}\\
",w(n-i-1),w(2*i+1))}}

Attempt This Online!

Perl 5 -n, 59 bytes

map{//;say map$_|$'?$_-$'?$_+$'?$":'/':'\\':X,@a}@a=-$_..$_

Try it online!

Uses the same logic as my ASCII sun answer here.

It treats the output as an X-Y grid from -n to +n where n is the input value. If X==-Y, output a slash. If X==Y, output a backslash. Put an X at the origin. Everything else is a space.

Perl 5 + -M5.10.0 -pla, 78 bytes

@n=($")x$F[0]--,$_=$"x--$_."\\@n/",say,$\=$/.y'/\\'\/'r.$\for 1..$_;$_=$"x$_.X

Try it online!

Explanation

Loops for 1..$_ (implicit line from STDIN - n - from the implicit -n from -p). Each iteration sets @n to a list of n, decrementing ($F[0]--, $F[x] accesses the xth index of @F which is implicitly set, by -a, to the input, split on whitespace, which is only ever the one value, n), spaces ($"), then sets $_ the concatenation of the current loop value, less one, spaces, the interpolated string "\\@n/" where @n is expanded with a space between each element (which is also space) making n*2-1 spaces for each iteration. say outputs $_ by default and $\ is then prepended with a newline ($/) and the /result of transliterating (y''') all slashes to their opposite.

Outside of the loop $_ is set to n spaces and a literal X.

Because of -p $_ is automatically printed, followed by $\.


Some very similar alternatives that might be easier to golf further (all 78 bytes too):

$_=$"x--$_."\\@{[($\")x$F[0]--]}/",say,$\=$/.y'/\\'\/'r.$\for 1..$_;$_=$"x$_.X
map{@n=($")x$F[0]--;say$_=$"x--$_."\\@n/";$\=$/.y'/\\'\/'r.$\}1..$_;$_=$"x$_.X
map{say$_=$"x--$_."\\@{[($\")x$F[0]--]}/";$\=$/.y'/\\'\/'r.$\}1..$_;$_=$"x$_.X

Uiua SBCS, 22 21 bytes

⊏+⇌×2.⊞=.⇡+1×2:$  \/X

Try it!

-1 thanks to noodle man!

It turns out the method I used is the exact one used in Adám's APL answer. I didn't look though, I swear.

05AB1E, 15 bytes

>I'\×'X«3.Λ.º.∊

Try it online.

Explanation:

Step 1: Draw the top-left to bottom-right line:

>            # Increase the (implicit) input-integer by 1
 I'\×       '# Push a string with the input amount of "\"
     'X«    '# Append a "X" to that string
        3    # Push a 3
         .Λ  # Use the Canvas builtin with these three arguments

Try just the first step online.

Step 2: Mirror with overlap in both directions:

.º           # Intersected mirror horizontally
  .∊         # Intersected mirror vertically
             # (after which the result is output implicitly)

brainfuck, 285 276 bytes

+++++++++++[>+>>++++++++>++++>++++++++>+++<<<<<<-]>->>++++>+++>>->>>,[>>-<<[<<[<.>->+<]<[<]>.[>]>>[<<++>>->+<]<<-[<.>-]<<<.<<<.>>[>]+>[<+>-]>>-[<+>-]<]<<[<.>->>+<<]<<.<<<<.>>[>]>>[->+<[<<<.>>+>-]<<<<<.>>>>[>+<-]>>[<<<++>+>>-]<<[>>+<<-]<-[<.>-]<<[<]>.<<.>>[>]>>]]>>+[<<<<<<.>>]

Try it online!

Input uses bytes. So 1 is \x01

Alternative Version which supports numbers (366 313 bytes)

APL (Dyalog), 25 bytes

Requires ⎕IO←0 which is default on many systems.

' \/X'[(⊢+2×⌽)∘.=⍨⍳1+2×⎕]

Try it online!

' \/X'[] index the string with

 get input

 multiply by two

1+ add one

 that many integers

∘.=⍨ equality table (i.e. identity matrix; NW-SE diagonal)

() apply the following tacit function on that

   the argument

  + plus

   two times

   the horizontally mirrored argument (i.e. NE-SW diagonal)

Zsh, 83 bytes

2=${(l:$1:)}
S=$2\ $2
F()for i;(S[i]=\\;S[-i]=/;<<<$S)
F {1..$1}
<<<$2X
F {-$1..-1}

Try it online!

///, 223 bytes

/|/\\\\//i///& /  &// &///> /^b|b^v|v^^$|+^
f|fvv&i|||^$|-^^$|-^$|+^^<|$^<-|$>|->vv&i||||
^^<-|$^<|$^^f|f| ^ f|f^^>|->| ^ >|->^^f|fv|v^||||^^>|->v|v^|||^^^v|v  ^ b|b^>//^/\///b\/>/b\/\/$|+\/\/\/<|$\/\///>$+//>i$+
iX/<$//
<$

Try it online!

Seems like a fitting language for the challenge. (suck it, sed)

Input is given in unary spaces, after /i/:

/|/\\\\//i/<spaces here>//& /  &// &///...

Explanation: don't ask me, I only programmed it ;)

sorta commented version, lightly ungolfed version

I didn't save the pregolfed code, and I don't understand it enough anymore to take it apart again (or maybe just laziness, who knows)

C, 108 106 104 bytes

a;g(n){for(int b=2*n,i=1,c=47;a+=i;!b?i=-i,c=92:puts(""),b-=2*i)printf("%*c%*c",a,b?c^115:88,b,b?c:10);}

Try it online!

(−2 golfing thanks to MD XF)

(−1 golfing thanks to ceilingcat)

It prints two characters (at first, c = 47, which is a slash, and c + 45, which is a backslash; then they are swapped) with a dynamic field width.

The field widths start at 1 and 2n, and at each iteration, the first width is incremented by 1, and the second one is decremented by 2.

When the second field width becomes 0, it outputs 'X' and a newline instead of the regular characters, and reverses the direction of increments (i). A newline is printed for all other lines separately (puts("")).

C (gcc), 99 85 bytes

f(x,h,t){for(h=2*x+2,t=h*h-h;t--;putchar(t^h*x-~x?t%h?~-t%~h?t%~-h?32:47:92:10:88));}

-14 bytes, Thanks to ceilingcat

Try it online!

Canvas, 3 bytes

╵\┼

Try it here!

half of the size of the Charcoal answer :D

╵    increment the input
 \   create a diagonal that long
  ┼  and quad-palindromize, mirroring what's required, with 1 overlap;
     This overlaps the `/` and `\`, resulting in `X`

R, 75 72 bytes

y=diag(b<-2*scan()+1);write(c(" ",'\\','/','X')[y+2*y[,b:1]+1],'',b,,'')

Inspired by this answer, generates an implicit matrix and writes it to stdout; reads the size from stdin. It has to build a matrix of space characters and uses sep='' b/c otherwise it has spacing issues.

diag(b)                     # generates a main diagonal of 1, rest 0
2*diag(b)[,b:1]             # the other diagonal is 2
                            # [,b:1] reverses columns
                            # [b:1,] reverses the rows; they're equivalent
diag(b)+2*diag(b)[,b:1]     # sums, so we get 1 for main diagonal
                            # 2 for other diagonal, 3 for center
diag(b)+2*diag(b)[,b:1]+1   # add 1 since R is 1-indexed
                            # the result is indices for the vector
c(' ','\\','/','X')

Try it online!

05AB1E, 21 bytes

F'\Nú}'X¹ú).B€.∞ø€.∞»

Try it online!

Jelly, 24 17 bytes

Ḥ‘=þ`µḤ+Uị“/\x ”Y

Try it online!

How it Works

Ḥ‘=þ`µḤ+Uị“/\x ”Y   main link, input a
Ḥ‘                  input doubled and incremented
   þ                Make a table: Apply  
  =                 "equals"/ to      
    `               each element in range(2a+1) cartesian multiplied with itself.
                      eg. For input 1: [1=1,1=2,1=3],[2=1,2=2,2=3],[3=1,3=2,3=3]      
     µ              on this array:
       +            add: 
      Ḥ             double of it to
        U           its reverse (changes south-east to north-west)
         ị“/\x ”    index into the string "/\x " to get the right characters
                Y   join by newlines for the final output.

-6 bytes thanks to @LeakyNun and -1 byte with an additional improvement

Ruby, 66 bytes

Recursive function.

f=->x{?X[x]||"\\#{s=' '*(2*x-1)}/
#{f[x-1].gsub /^/,' '}
/#{s}\\"}

Try it online!

Explanation

f=->x{                  # Start of recursive function named `f`
      ?X[x]||           # Return 'X' if x==0, otherwise the following:
"\\#{s=' '*(2x-1)}/     #  Top edge of the cross. Save no. of spaces needed
#{f[x-1]                #  Get result of f[x-1]
        .gsub /^/,' '}  #  Regex sub to left-pad every line w/ a space
/#{s}\\"                #  Bottom edge of cross (insert saved no. of spaces)

T-SQL, 201 bytes

DECLARE @ INT SELECT @=a FROM t DECLARE @i INT=@
WHILE @>0BEGIN PRINT SPACE(@i-@)+'\'+SPACE(2*@-1)+'/'SET @-=1 END
PRINT SPACE(@i)+'X'WHILE @<@i BEGIN SET @+=1 PRINT SPACE(@i-@)+'/'+SPACE(2*@-1)+'\'END

Formatted:

DECLARE @ INT 
SELECT @=a FROM t 
DECLARE @i INT=@
WHILE @>0
    BEGIN
        PRINT SPACE(@i-@)+'\'+SPACE(2*@-1)+'/'
        SET @-=1 
    END
PRINT SPACE(@i)+'X'
WHILE @<@i 
    BEGIN 
        SET @+=1 
        PRINT SPACE(@i-@)+'/'+SPACE(2*@-1)+'\'
    END

Input is via column a in named table t, per our guidelines.

Pyke, 14 bytes

\XQV.X \   /\/

Try it here!

\X             - "X"
  QV           - repeat input times:
    .X \   /\/ -  surround(^, all=" ", 
                              tl="\", 
                              left=" ",  
                              right=" ",  
                              lower=" ",  
                              tr="/",  
                              br="\",  
                              bl="/")

Java (OpenJDK 8), 135 bytes

i->{int k=0,j,l=2*i+1;String[]s=new String[l];for(;k<l;k++)for(s[k]="",j=0;j<l;j++)s[k]+=j==k?j==i?"X":"\\":j==l-1-k?"/":" ";return s;}

Lambda expression that takes and integer and returns an array of Strings

Try it online!

Ungolfed:

i->{
    int k=0,j,l=2*i+1;                // Some variables to be used
    String[]s=new String[l];            // Return array (size 2*i+1)
    for(;k<l;k++)                       // For each array entry
        for(s[k]="",j=0;j<l;j++)        // Set each character to 
            s[k]+=j==k?j==i?"X":"\\"    // \ or X if it's the jth character of the jth row
                 :j==l-1-k?"/"          // / if it's the opposite char
                 :" ";                  // else blank
    return s;
}

C, 168 155 150 bytes

-5 thanks to Computronium

#define p printf(
s(x){while(x--)p" ");}j;f(x){for(;j<x;j++)s(j),p"\\"),s((x-j)*2-1),p"/\n");s(x);p"X\n");while(j--)s(j),p"/"),s((x-j)*2-1),p"\\\n");}

Can certainly be golfed; I'm doing so. Try it online!

Ungolfed:

int space(int x)
{
    while (x--)
        putchar(' ');
}

int f(int x)
{
    for (int j = 0; j < x; j++) {
        space(j);
        printf("\\");
        space((x-j)*2-1);
        printf("/\n");
    }

    space(x);
    puts("X");

    while (j--) {
        space(j);
        putchar('/');
        space((x-j)*2-1);
        printf("\\\n");
    }
}

Python 2, 95 84 bytes

-10 bytes thanks to @FelipeNardiBatista

f=lambda s,i='\n':i+(s and'\\'+'  '*~-s+' /'+f(s-1,i+' ')+i+'/'+'  '*~-s+' \\'or'X')

Try it online!

Bash, 138 bytes

for i in `seq $1;seq $[$1-1] -1 1`
{ $[a++]
printf "%*c%*s\n" `echo ' '$i $[a>$1?1:2] $[($1-i)*2]' '$[a<$1?1:2]`
}|sed 's/22/X/'|tr 12 /\\

Try it online!

Really long, bash heates '\ and /'

Less golfed

 for i in {1..10} {9..1};{
   $[a++];                      #argument as padding, prints 1 for \ and 2 for /
   printf "%*c%*s\n" `echo ' '$i $[a>$1?1:2] $[($1-i)*2]' '$[a<$1?1:2]`;
  }|sed 's/22/X/g' | tr 12 /\\

Mathematica, 71 bytes

(Partially inspired by Jenny_mathy's 104-byte solution)

""<>#&/@(#"\\"+Reverse@#"/"&@IdentityMatrix[2#+1]/.{0->" ",a_+_->"X"})&

Returns a list of strings.

Explanation: IdentityMatrix[2#+1] makes a matrix of the right size with 1s along the diagonal and 0s elsewhere. Next, we multiply it by "\\" (an escaped backslash), which makes it a matrix with backslashes along the diagonal and 0s elsewhere, since of course 1 times backslash is backslash and 0 times backslash is 0. We add this to "/" times its reverse to make the X shape. We're nearly done, except there are still 0s everywhere, and the middle is "\\" + "/". We fix these two things by substituting " " for 0 and "X" for a_+_, which matches any sum of two things (like _+_ should, except Mathematica is too clever for its own good and interprets that as 2 times _). Finally, ""<>#&/@ turns this into a list of strings.

MATL, 16 bytes

'\/X 'iEQXytEP+)

Try it online!

Consider input 2 as an example. The stack is shown here upside down, i.e. lower elements are the ones most recently pushed.

'\/X '  % Push this string
        %   STACK: '\/X '
iEQ     % Input a number, n. Multiply by 2, add 1: gives 2*n+1
        %   STACK: '\/X '
                   5
Xy      % Identity matrix of that size
        %   STACK: '\/X '
                   [1 0 0 0 0;
                    0 1 0 0 0;
                    0 0 1 0 0;
                    0 0 0 1 0;
                    0 0 0 0 1]
tEP     % Duplicate, multiply each entry by 2, flip vertically
        %   STACK: '\/X '
                   [1 0 0 0 0;
                    0 1 0 0 0;
                    0 0 1 0 0;
                    0 0 0 1 0;
                    0 0 0 0 1]
                   [0 0 0 0 2;
                    0 0 0 2 0;
                    0 0 2 0 0;
                    0 2 0 0 0;
                    2 0 0 0 0]
+       % Add the two matrices
        %   STACK: '\/X '
                   [1 0 0 0 2;
                    0 1 0 2 0;
                    0 0 3 0 0;
                    0 2 0 1 0;
                    2 0 0 0 1]
)       % Index into the string. Indexing is 1-based and modular, so 1 picks
        % the first character ('\'), ..., 0 picks the last (space)
        %   STACK: ['\   /';
                    ' \ / ';
                    '  X  ';
                    ' / \ ';
                    '/   \']
        % Implicit display

C#, 157 122 120 bytes

_=d=>"".PadLeft(d)
a=>{var s=_(a)+"X\n";for(int i=0;++i<=a;)s=$@"{_(a-i)}\{_(i*2-1)}/
{s+_(a-i)}/{_(i*2-1)}\
";return s;}

Ungolfed version:

 Func<int, string> _ = (d) =>"".PadLeft(d);
        Func<int, string> func = a => {

            var s = _(a) + "X\n";

            for (int i = 0; ++i <= a;) {

                s = $@"{_(a - i)}\{_(i * 2 - 1)}/
{s + _(a - i)}/{_(i * 2 - 1)}\
";

            }
            return s;
        };

05AB1E, 22 bytes

F'\IN-úR.∞})Âí'Xs)˜.c»

Try it online!

Explanation

F                        # for N in [0...input-1] do
 '\                      # push a backslash
   IN-ú                  # prepend input-N spaces
       R                 # reverse
        .∞               # mirror
          }              # end loop
           )             # wrap stack in a list
            Â            # bifurcate
             í           # reverse each item
              'Xs        # push an "X" between the 2 lists on the stack
                 )˜      # wrap in flattened list
                   .c    # pad lines to equal length
                     »   # join on newlines

Alternative 22 byte solution

F'\N·>ú'/ì})Âí'X¸«ì.c»

Visual Basic.Net, 454 450 Bytes

Option Strict Off
module m
sub main(a As String())
dim v=Convert.toInt32(a(0))
for i as Integer=v to 1 step -1
for j as Object=1 to v-i
w(" ")
next
w("\")
for j as Object=1 to i*2-1
w(" ")
next
console.writeline("/")
next
console.writeline(new String(" ",v)&"X")
for i as Object=1 to v
for j as Object=1 to v-i
w(" ")
next
w("/")
for j as Object=1 to i*2-1
w(" ")
next
console.writeline("\")
next
end sub
sub w(s)
console.write(s)
end Sub
end module

not sure whether making a func for writeline will save some bytes thanks to Stephen S for pointing at as ... removal also changed integer into object last edit changed the first one back

JavaScript (ES6), 79 bytes

Uses a recursive function g that walks through a grid and builds the output character by character.

n=>(g=x=>`/\\ X
`[~x?x-y?x+y-w&&2:x-n?1:3:4]+(~y?g(~x--?x:y--&&w):''))(y=w=n*2)

How?

Both variables x and y iterate from 2n to -1, where n is the input.

For each position (x, y) in the grid, we pick one of these characters:

using the following tests:

and the following decision tree:

decision tree

Demo

let f =

n=>(g=x=>`/\\ X
`[~x?x-y?x+y-w&&2:x-n?1:3:4]+(~y?g(~x--?x:y--&&w):''))(y=w=n*2)

console.log(f(0))
console.log(f(1))
console.log(f(4))

Mathematica, 131 bytes

(F[x_,y_]:=Table[x<>StringJoin@Table[" ",i]<>y,{i,1,#*2,2}];Column[Join[Reverse@F["\\","/"],{"X"},F["/","\\"]],Alignment->Center])&


Mathematica, 104 bytes

here is another approach using Grid

(S=DiagonalMatrix[Table["\\",r=2#+1]];Table[S[[r+1-i,0+i]]="/",{i,r}];S[[#+1,#+1]]="X";Grid@S/. 0->" ")&

Retina, 74 bytes

.+
$* X
+`^ ( *).( *)
$1\  $2/¶$&
+`¶ ( *).( *).?$
$&¶$1/  $2\
m` (\W)$
$1

Try it online! Explanation:

.+
$* X

Place the X.

+`^ ( *).( *)
$1\  $2/¶$&

Starting at the X, working upwards, place a \ diagonally to the left each time. Also place a / two more spaces after the / than last time.

+`¶ ( *).( *).?$
$&¶$1/  $2\

Starting at the X, working downwards, place a / diagonally to the left each time. Also place a \ two more spaces after the / than last time.

m` (\W)$
$1

The number of spaces between the two diagonals needs to be odd, so the last space on each line (except the original X line) is deleted.

Python 2, 81 bytes

r=range(2*input()+1)
for i in r:print''.join(' \/X'[i==j::2][r[~i]==j]for j in r)

Try it online!

QBIC, 90 bytes

~b=0|?@X`\[0,:-1|X=space$(a)┘Z=Z+X+@\`+space$((b-a)*2-1)+@/`+X+@┘`]Z=Z+space$(b)+A+_fZ

How this monstrosity works, is left as an excercise for the reader...

Sample output:

Command line: 3
\     /
 \   / 
  \ /  
   X
  / \  
 /   \ 
/     \

PHP, 115 bytes

for(;$i<$c=1+2*$argn;$b?:$t[$i-1]="\\".!$t[$c-$i]="/",$o.="$t\n")$t=str_pad(" X"[$b=$argn==+$i++],$c," ",2);echo$o;

Try it online!

Perl 5, 110 + 1 = 111 bytes

Uses -n flag.

$x=$_;$,="\n";push@x,$"x($x-$_)."\\".$"x(2*--$_+1)."/"while$_>0;say@x,$"x$x."x";for(reverse@x){y!\\/!/\\!;say}

shortC, 111 bytes

s(x){Wx--)R" ")}j;f(x){O;j<x;j++)s(j),P92),s((x-j)*2-1),R"/\n");s(x);R"X\n");Wj--)s(j),P47),s((x-j)*2-1),R"\\\n

Based on my C answer. Conversions:

This also uses ASCII codes for \ and /.

Try it online!

Batch, 201 bytes

@echo off
set s= /
for /l %%i in (2,1,%1)do call set s=  %%s%%
set s=\%s%
for /l %%i in (-%1,1,%1)do call:c
exit/b
:c
echo %s%
set s=%s:\ = \%
set s=%s:X =/\%
set s=%s:\/=X %
set s=%s: /=/ %

Starts by building up the top line, then after printing each line, moves the \ right one space and the / left once space, making sure that they make an X in the middle.

V, 21 bytes

éXÀñ>HÄÒ r\Á/YGpr/$r\

Try it online!

Hexdump:

00000000: e958 c0f1 3e48 c4d2 2072 5cc1 2f59 4770  .X..>H.. r\./YGp
00000010: 722f 2472 5c                             r/$r\

Explanation:

éX                      " Insert an 'X'
  Àñ                    " Arg1 times:
    >H                  "   Add a space to every line.
                        "   Conveniently, this also puts us on the first line
      Ä                 "   Duplicate this line
       Ò                "   And replace the whole line with spaces
         r\             "   Replace the first char with '\'
           Á/           "   Append a '/' char
             Y          "   Yank this line
              G         "   Move to the last line
               p        "   And paste the line we yanked
                r/      "   Replace the first character with a '/'
                  $     "   Move to the end of the line
                   r\   "   And replace the last character with a '\'

Essentially, we have Insert an X, n times extend the slashes.

But it's not quite that simple because we also have to add the slashes the first time. If the slashes were already there, we could write extend the slashes as:

>HÄX2pGÙX2p

Which would save us 6 bytes.

Charcoal, 6 bytes

PX⁺¹NX

Your nonsense ain't stopping me ;)

Try it online!