Add support for global options
diff --git a/R/add_footnote.R b/R/add_footnote.R
index 5977104..dd1bd4b 100644
--- a/R/add_footnote.R
+++ b/R/add_footnote.R
@@ -17,15 +17,24 @@
 #'
 #' @export
 add_footnote <- function(input, label = NULL,
-                         notation = c("alphabet", "number", "symbol"),
+                         notation = "alphabet",
                          threeparttable = FALSE) {
   if (is.null(label)) return(input)
 
-  notation <- match.arg(notation)
+  if (notation == "alphabet") {
+    notation <- getOption("kable_footnote_notation", "alphabet")
+  }
+  if (!threeparttable) {
+    threeparttable <- getOption("kable_footnote_threeparttable", FALSE)
+  }
+
+  notation <- match.arg(notation, c("alphabet", "number", "symbol"))
   if (notation == "symbol") {
     notation <- paste0(notation, ".", attr(input, "format"))
   }
 
+  table_info <- NULL
+
   ids.ops <- read.csv(system.file("symbol_index.csv", package = "kableExtra"))
   ids <- ids.ops[, notation]
   ids.intable <- gsub("\\*", "\\\\*", ids)
@@ -86,8 +95,8 @@
     label <- escape_latex(label)
     label <- gsub("\\\\", "\\\\\\\\", label)
 
-    kable_info <- magic_mirror(input)
-    if (kable_info$tabular == "longtable") {
+    table_info <- magic_mirror(input)
+    if (table_info$tabular == "longtable") {
       if (notation != "number") {
         warning("Notation is set to 'number' and other formats are not supported.")
         notation <- "number"
@@ -104,8 +113,8 @@
       # See http://tex.stackexchange.com/questions/50151/footnotes-in-longtable-captions
 
       count.in.caption.note <- 0
-      if (!is.na(kable_info$caption)) {
-        count.in.caption.note <- str_count(kable_info$caption, "\\[note\\]")
+      if (!is.na(table_info$caption)) {
+        count.in.caption.note <- str_count(table_info$caption, "\\[note\\]")
       }
       if (count.in.caption.note != 0) {
         caption.footnote <- paste0("\\\\addtocounter{footnote}{-",
@@ -173,17 +182,17 @@
       } else {
         table.width <- max(nchar(
           str_replace_all(
-            str_replace_all(kable_info$contents, "\\[note\\]", ""),
-            "\\[note[0-9]{1,2}\\]", ""))) + 2 * (kable_info$ncol - 1)
+            str_replace_all(table_info$contents, "\\[note\\]", ""),
+            "\\[note[0-9]{1,2}\\]", ""))) + 2 * (table_info$ncol - 1)
         footer <- ""
         for (i in 1:count.label) {
           label.wrap <- strwrap(label[i], table.width)
-          footer <- paste0(footer, "\\\\multicolumn{", kable_info$ncol,
+          footer <- paste0(footer, "\\\\multicolumn{", table_info$ncol,
                            "}{l}{\\\\textsuperscript{", ids[i], "} ",
                            label.wrap[1], "}\\\\\\\\\n")
           if (length(label.wrap) > 1) {
             for (j in 2:length(label.wrap)) {
-              footer <- paste0(footer, "\\\\multicolumn{", kable_info$ncol,
+              footer <- paste0(footer, "\\\\multicolumn{", table_info$ncol,
                                "}{l}{", label.wrap[j], "}\\\\\\\\\n")
             }
           }
@@ -198,8 +207,8 @@
   # HTML Tables -------------------
   if (attr(input, "format") == "html") {
     # Clean the entry for labels
+    table_info <- magic_mirror(input)
     label <- escape_html(label)
-
     # Replace in-table notation with appropriate symbol
     for (i in 1:count.intablenote) {
       export <- sub("\\[note\\]",
@@ -226,5 +235,6 @@
     # Paste footer to the table
     export[1] <- gsub("</tbody>\n", paste0("</tbody>\n", footer), export[1])
   }
+  attr(export, "original_kable_meta") <- table_info
   return(export)
 }