add footnote for latex
diff --git a/R/footnote.R b/R/footnote.R
index 96af153..9999be7 100644
--- a/R/footnote.R
+++ b/R/footnote.R
@@ -47,9 +47,9 @@
   if (kable_format == "html") {
     return(footnote_html(kable_input, footnote_table, footnote_as_chunk))
   }
-  # if (kable_format == "latex") {
-  #   return(footnote_latex(kable_input, footnote_table))
-  # }
+  if (kable_format == "latex") {
+    return(footnote_latex(kable_input, footnote_table, footnote_as_chunk))
+  }
 }
 
 footnote_table_maker <- function(format, footnote_titles, footnote_contents) {
@@ -147,8 +147,55 @@
 # LaTeX
 footnote_latex <- function(kable_input, footnote_table, footnote_as_chunk) {
   table_info <- magic_mirror(kable_input)
+  out <- enc2utf8(as.character(kable_input))
+  if (table_info$tabular == "longtable") {
+    return()
+  }
+  footnote_text <- latex_tfoot_maker(footnote_table, footnote_as_chunk,
+                                     table_info$ncol)
+  out <- sub(table_info$end_tabular,
+             paste0(footnote_text, "\n\\\\end{", table_info$tabular, "}"),
+             out)
+  out <- structure(out, format = "latex", class = "knitr_kable")
+  attr(out, "kable_meta") <- table_info
+  return(out)
 
+}
 
+latex_tfoot_maker <- function(footnote_table, footnote_as_chunk, ncol) {
+  footnote_types <- names(footnote_table$contents)
+  footnote_text <- c()
+  for (i in footnote_types) {
+    footnote_text <- c(footnote_text, latex_tfoot_maker_(
+      footnote_table$contents[[i]], footnote_table$titles[[i]], i,
+      footnote_as_chunk, ncol))
+  }
+  footnote_text <- paste0(footnote_text, collapse = "\n")
+  return(footnote_text)
+}
 
-
+latex_tfoot_maker_ <- function(ft_contents, ft_title, ft_type, ft_chunk, ncol) {
+  footnote_text <- apply(ft_contents, 1, function(x) {
+    if (x[1] == "") {
+      x[2]
+    } else {
+      paste0('\\\\textsuperscript{', x[1], '} ', x[2])
+    }
+  })
+  if (ft_title != "") {
+    title_text <- paste0('\\\\textbf{', ft_title, '} ')
+    footnote_text <- c(title_text, footnote_text)
+  }
+  if (!ft_chunk) {
+    footnote_text <- paste0(
+      '\\\\multicolumn{', ncol, '}{l}{', footnote_text, '}\\\\\\\\'
+    )
+  } else {
+    footnote_text <- paste0(
+      '\\\\multicolumn{', ncol, '}{l}{',
+      paste0(footnote_text, collapse = " "),
+      '}\\\\\\\\'
+    )
+  }
+  return(footnote_text)
 }
diff --git a/R/footnote_marker.R b/R/footnote_marker.R
index b0d1988..45ffafb 100644
--- a/R/footnote_marker.R
+++ b/R/footnote_marker.R
@@ -11,7 +11,7 @@
   if (format == "html") {
     return(paste0("<sup>", x, "</sup>"))
   } else {
-    return(paste0("\\\\textsuperscript{", x, "}"))
+    return(paste0("\\textsuperscript{", x, "}"))
   }
 }
 
@@ -28,7 +28,7 @@
   if (format == "html") {
     return(paste0("<sup>", x, "</sup>"))
   } else {
-    return(paste0("\\\\textsuperscript{", x, "}"))
+    return(paste0("\\textsuperscript{", x, "}"))
   }
 }
 
@@ -48,6 +48,6 @@
     return(paste0("<sup>", x, "</sup>"))
   } else {
     x <- number_index$symbol.latex[x]
-    return(paste0("\\\\textsuperscript{", x, "}"))
+    return(paste0("\\textsuperscript{", x, "}"))
   }
 }
diff --git a/inst/NEWS.md b/inst/NEWS.md
index 48bb7b9..8ed69b4 100644
--- a/inst/NEWS.md
+++ b/inst/NEWS.md
@@ -2,6 +2,8 @@
 * Added HTML color code support to kableExtra
 * Fixed bug #105: bold/italic/monospace cannot accept T/F as vector
 * Added extra_css to cell_spec, row_spec & column_spec
+* Fixed bug #88: add_footnote doesn't support full width
+
 
 
 kableExtra 0.6.1
diff --git a/tests/visual_tests/add_footnote_pdf.Rmd b/tests/visual_tests/add_footnote_pdf.Rmd
index 86bb0af..54aa844 100644
--- a/tests/visual_tests/add_footnote_pdf.Rmd
+++ b/tests/visual_tests/add_footnote_pdf.Rmd
@@ -44,6 +44,7 @@
 ```
 
 ```{r}
-kable(dt, format = "latex", booktabs = T, longtable = T) %>%
-add_footnote(c("Footnote 1", "Have a good day."), notation = "alphabet")
+kable(dt, format = "latex", booktabs = T) %>%
+  kable_styling(full_width = T) %>%
+  add_footnote(c("Footnote 1", "Have a good day.", "sss"), notation = "alphabet")
 ```
diff --git a/tests/visual_tests/footnote_latex.Rmd b/tests/visual_tests/footnote_latex.Rmd
index 2f6e558..718d057 100644
--- a/tests/visual_tests/footnote_latex.Rmd
+++ b/tests/visual_tests/footnote_latex.Rmd
@@ -2,17 +2,20 @@
 title: "add_footnote_adv"
 author: "Hao"
 date: "1/5/2018"
-output: html_document
+output: pdf_document
 ---
 
 ```{r}
 library(knitr)
 library(kableExtra)
 
-mtcars[1:5, 1:5] %>%
-  kable("html", caption = paste0("test", footnote_marker_symbol(1))) %>%
-  kable_styling() %>%
-  footnote("ccc", c("number 1; ", "number 2. "), c("a 1; ", "a 2."), c("s 1; ", "s 2."),
-                   number_title = "special: ", alphabet_title = "abc: ", 
-                   footnote_as_chunk = T)
+dt <- mtcars[1:5, 1:2]
+colnames(dt)[1] <- paste0("mpg", footnote_marker_alphabet(2, "latex"))
+
+dt %>%
+  kable("latex", caption = paste0("test", footnote_marker_symbol(1, "latex")),
+        booktabs = T, escape = F) %>%
+  footnote(NULL, c("number 1; ", "number 2. "), c("a 1; ", "a 2."), c("s 1; ", "s 2."),
+           number_title = "special: ", alphabet_title = "abc: ", 
+           footnote_as_chunk = T)
 ```