Like this?
library(grid)
library(gridExtra)
# Generate random n and m
n <- round(runif(1, 3, 10))
m <- round(runif(1, 11, 18))
# Create intervals with numeric values
intervalos17 <- c(paste0("x<", n),paste0(n, "<=x<", m),paste0("x>=", m))
# Create the fraction with ACTUAL n and m values
prueba17 <- c(0, paste0("frac(x-", n, ", ", m-n, ")"),1)
# Create and display the table
tablasolucion <- data.frame(intervalos17, prueba17)
colnames(tablasolucion) <- c("x", "F(x)")
tt <- ttheme_default(core = list(fg_params = list(parse=TRUE)), colhead = list(fg_params = list(parse=TRUE)))
grid.newpage()
grid.table(tablasolucion, rows = NULL, theme=tt)