Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html > |
| 3 | |
| 4 | <head> |
| 5 | |
| 6 | <meta charset="UTF-8"> |
| 7 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
Hao Zhu | c859dba | 2018-10-03 18:05:55 -0400 | [diff] [blame] | 8 | <title>Using kableExtra in Bookdown</title> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 9 | <meta name="description" content="This example provides documentations for using kableExtra to customize tables in bookdown projects."> |
| 10 | <meta name="generator" content="bookdown and GitBook 2.6.7"> |
| 11 | |
Hao Zhu | c859dba | 2018-10-03 18:05:55 -0400 | [diff] [blame] | 12 | <meta property="og:title" content="Using kableExtra in Bookdown" /> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 13 | <meta property="og:type" content="book" /> |
| 14 | |
| 15 | |
| 16 | <meta property="og:description" content="This example provides documentations for using kableExtra to customize tables in bookdown projects." /> |
| 17 | |
| 18 | |
| 19 | <meta name="twitter:card" content="summary" /> |
Hao Zhu | c859dba | 2018-10-03 18:05:55 -0400 | [diff] [blame] | 20 | <meta name="twitter:title" content="Using kableExtra in Bookdown" /> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 21 | |
| 22 | <meta name="twitter:description" content="This example provides documentations for using kableExtra to customize tables in bookdown projects." /> |
| 23 | |
| 24 | |
| 25 | <meta name="author" content="Hao Zhu"> |
| 26 | |
| 27 | |
Hao Zhu | 5250ab5 | 2018-10-23 15:25:14 -0400 | [diff] [blame^] | 28 | <meta name="date" content="2018-10-23"> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 29 | |
| 30 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 31 | <meta name="apple-mobile-web-app-capable" content="yes"> |
| 32 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| 33 | |
| 34 | |
| 35 | |
| 36 | <link rel="next" href="cross-format-tables-in-bookdown.html"> |
| 37 | <script src="libs/jquery-2.2.3/jquery.min.js"></script> |
| 38 | <link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" /> |
| 39 | <link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" /> |
| 40 | <link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" /> |
| 41 | <link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" /> |
| 42 | <link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" /> |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | <script src="libs/kePrint-0.0.1/kePrint.js"></script> |
| 51 | <link href="libs/bsTable-3.3.7/bootstrapTable.min.css" rel="stylesheet" /> |
| 52 | |
| 53 | |
| 54 | <style type="text/css"> |
| 55 | a.sourceLine { display: inline-block; line-height: 1.25; } |
| 56 | a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; } |
| 57 | a.sourceLine:empty { height: 1.2em; position: absolute; } |
| 58 | .sourceCode { overflow: visible; } |
| 59 | code.sourceCode { white-space: pre; position: relative; } |
| 60 | div.sourceCode { margin: 1em 0; } |
| 61 | pre.sourceCode { margin: 0; } |
| 62 | @media screen { |
| 63 | div.sourceCode { overflow: auto; } |
| 64 | } |
| 65 | @media print { |
| 66 | code.sourceCode { white-space: pre-wrap; } |
| 67 | a.sourceLine { text-indent: -1em; padding-left: 1em; } |
| 68 | } |
| 69 | pre.numberSource a.sourceLine |
| 70 | { position: relative; } |
| 71 | pre.numberSource a.sourceLine:empty |
| 72 | { position: absolute; } |
| 73 | pre.numberSource a.sourceLine::before |
| 74 | { content: attr(data-line-number); |
| 75 | position: absolute; left: -5em; text-align: right; vertical-align: baseline; |
| 76 | border: none; pointer-events: all; |
| 77 | -webkit-touch-callout: none; -webkit-user-select: none; |
| 78 | -khtml-user-select: none; -moz-user-select: none; |
| 79 | -ms-user-select: none; user-select: none; |
| 80 | padding: 0 4px; width: 4em; |
| 81 | color: #aaaaaa; |
| 82 | } |
| 83 | pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } |
| 84 | div.sourceCode |
| 85 | { } |
| 86 | @media screen { |
| 87 | a.sourceLine::before { text-decoration: underline; } |
| 88 | } |
| 89 | code span.al { color: #ff0000; font-weight: bold; } /* Alert */ |
| 90 | code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ |
| 91 | code span.at { color: #7d9029; } /* Attribute */ |
| 92 | code span.bn { color: #40a070; } /* BaseN */ |
| 93 | code span.bu { } /* BuiltIn */ |
| 94 | code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ |
| 95 | code span.ch { color: #4070a0; } /* Char */ |
| 96 | code span.cn { color: #880000; } /* Constant */ |
| 97 | code span.co { color: #60a0b0; font-style: italic; } /* Comment */ |
| 98 | code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ |
| 99 | code span.do { color: #ba2121; font-style: italic; } /* Documentation */ |
| 100 | code span.dt { color: #902000; } /* DataType */ |
| 101 | code span.dv { color: #40a070; } /* DecVal */ |
| 102 | code span.er { color: #ff0000; font-weight: bold; } /* Error */ |
| 103 | code span.ex { } /* Extension */ |
| 104 | code span.fl { color: #40a070; } /* Float */ |
| 105 | code span.fu { color: #06287e; } /* Function */ |
| 106 | code span.im { } /* Import */ |
| 107 | code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ |
| 108 | code span.kw { color: #007020; font-weight: bold; } /* Keyword */ |
| 109 | code span.op { color: #666666; } /* Operator */ |
| 110 | code span.ot { color: #007020; } /* Other */ |
| 111 | code span.pp { color: #bc7a00; } /* Preprocessor */ |
| 112 | code span.sc { color: #4070a0; } /* SpecialChar */ |
| 113 | code span.ss { color: #bb6688; } /* SpecialString */ |
| 114 | code span.st { color: #4070a0; } /* String */ |
| 115 | code span.va { color: #19177c; } /* Variable */ |
| 116 | code span.vs { color: #4070a0; } /* VerbatimString */ |
| 117 | code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ |
| 118 | </style> |
| 119 | |
| 120 | </head> |
| 121 | |
| 122 | <body> |
| 123 | |
| 124 | |
| 125 | |
| 126 | <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath="."> |
| 127 | |
| 128 | <div class="book-summary"> |
| 129 | <nav role="navigation"> |
| 130 | |
| 131 | <ul class="summary"> |
| 132 | <li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> Introduction</a></li> |
| 133 | <li class="chapter" data-level="2" data-path="cross-format-tables-in-bookdown.html"><a href="cross-format-tables-in-bookdown.html"><i class="fa fa-check"></i><b>2</b> Cross-format Tables in Bookdown</a><ul> |
| 134 | <li class="chapter" data-level="2.1" data-path="cross-format-tables-in-bookdown.html"><a href="cross-format-tables-in-bookdown.html#use-the-k-m-approach-instead-of-m-k"><i class="fa fa-check"></i><b>2.1</b> Use the “K-M” approach instead of “M-K”</a></li> |
Hao Zhu | 5250ab5 | 2018-10-23 15:25:14 -0400 | [diff] [blame^] | 135 | <li class="chapter" data-level="2.2" data-path="cross-format-tables-in-bookdown.html"><a href="cross-format-tables-in-bookdown.html#prepare-your-tables-for-all-formats"><i class="fa fa-check"></i><b>2.2</b> Prepare Your Tables for All Formats</a></li> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 136 | </ul></li> |
| 137 | <li class="chapter" data-level="3" data-path="use-bootstrap-tables-in-gitbooks-epub.html"><a href="use-bootstrap-tables-in-gitbooks-epub.html"><i class="fa fa-check"></i><b>3</b> Use Bootstrap Tables in gitbooks & epub</a><ul> |
| 138 | <li class="chapter" data-level="3.1" data-path="use-bootstrap-tables-in-gitbooks-epub.html"><a href="use-bootstrap-tables-in-gitbooks-epub.html#gitbook"><i class="fa fa-check"></i><b>3.1</b> Gitbook</a></li> |
| 139 | <li class="chapter" data-level="3.2" data-path="use-bootstrap-tables-in-gitbooks-epub.html"><a href="use-bootstrap-tables-in-gitbooks-epub.html#epub"><i class="fa fa-check"></i><b>3.2</b> Epub</a></li> |
| 140 | </ul></li> |
| 141 | </ul> |
| 142 | |
| 143 | </nav> |
| 144 | </div> |
| 145 | |
| 146 | <div class="book-body"> |
| 147 | <div class="body-inner"> |
| 148 | <div class="book-header" role="navigation"> |
| 149 | <h1> |
Hao Zhu | c859dba | 2018-10-03 18:05:55 -0400 | [diff] [blame] | 150 | <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Using kableExtra in Bookdown</a> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 151 | </h1> |
| 152 | </div> |
| 153 | |
| 154 | <div class="page-wrapper" tabindex="-1" role="main"> |
| 155 | <div class="page-inner"> |
| 156 | |
| 157 | <section class="normal" id="section-"> |
| 158 | <div id="header"> |
Hao Zhu | c859dba | 2018-10-03 18:05:55 -0400 | [diff] [blame] | 159 | <h1 class="title">Using kableExtra in Bookdown</h1> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 160 | <p class="author"><em>Hao Zhu</em></p> |
Hao Zhu | 5250ab5 | 2018-10-23 15:25:14 -0400 | [diff] [blame^] | 161 | <p class="date"><em>2018-10-23</em></p> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 162 | </div> |
| 163 | <div id="introduction" class="section level1"> |
| 164 | <h1><span class="header-section-number">Chapter 1</span> Introduction</h1> |
| 165 | <p>If you have tried to use <code>kableExtra</code> in a <code>bookdown</code> project with mutltiple formats, you may have experienced some problems. For example, you might not be able to render HTML and PDF tables at the same time using the same piece of code. At the same time, you might start to wonder if it’s possible to create <code>bootstrap</code> style tables in <code>gitbook</code>. I will try to address these issues using this example.</p> |
Hao Zhu | 6844920 | 2018-10-16 16:01:19 -0400 | [diff] [blame] | 166 | <p>This book is hosted at <a href="https://haozhu233.github.io/kableExtra/bookdown/index.html" class="uri">https://haozhu233.github.io/kableExtra/bookdown/index.html</a></p> |
Hao Zhu | c859dba | 2018-10-03 18:05:55 -0400 | [diff] [blame] | 167 | <p>You can download PDF & EPUB to see the results of kableExtra in those formats using the same code.</p> |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 168 | <p>You can find the source code for this project at <a href="https://github.com/haozhu233/kableExtra/tree/master/docs" class="uri">https://github.com/haozhu233/kableExtra/tree/master/docs</a>.</p> |
| 169 | |
| 170 | </div> |
| 171 | </section> |
| 172 | |
| 173 | </div> |
| 174 | </div> |
| 175 | </div> |
| 176 | |
| 177 | <a href="cross-format-tables-in-bookdown.html" class="navigation navigation-next navigation-unique" aria-label="Next page"><i class="fa fa-angle-right"></i></a> |
| 178 | </div> |
| 179 | </div> |
| 180 | <script src="libs/gitbook-2.6.7/js/app.min.js"></script> |
| 181 | <script src="libs/gitbook-2.6.7/js/lunr.js"></script> |
| 182 | <script src="libs/gitbook-2.6.7/js/plugin-search.js"></script> |
| 183 | <script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script> |
| 184 | <script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script> |
| 185 | <script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script> |
| 186 | <script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script> |
| 187 | <script> |
| 188 | gitbook.require(["gitbook"], function(gitbook) { |
| 189 | gitbook.start({ |
| 190 | "sharing": { |
| 191 | "github": false, |
| 192 | "facebook": true, |
| 193 | "twitter": true, |
| 194 | "google": false, |
| 195 | "linkedin": false, |
| 196 | "weibo": false, |
| 197 | "instapper": false, |
| 198 | "vk": false, |
| 199 | "all": ["facebook", "google", "twitter", "linkedin", "weibo", "instapaper"] |
| 200 | }, |
| 201 | "fontsettings": { |
| 202 | "theme": "white", |
| 203 | "family": "sans", |
| 204 | "size": 2 |
| 205 | }, |
| 206 | "edit": { |
| 207 | "link": null, |
| 208 | "text": null |
| 209 | }, |
| 210 | "download": ["bookdown_example.pdf", "bookdown_example.epub"], |
| 211 | "toc": { |
| 212 | "collapse": "subsection" |
| 213 | } |
| 214 | }); |
| 215 | }); |
| 216 | </script> |
| 217 | |
| 218 | </body> |
| 219 | |
| 220 | </html> |