1. \documentclass[]{article}
  2. \usepackage{amssymb,amsmath}
  3. \usepackage{ifxetex,ifluatex}
  4. \ifxetex
  5.  \usepackage{fontspec,xltxtra,xunicode}
  6.  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
  7. \else
  8.  \ifluatex
  9.    \usepackage{fontspec}
  10.    \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
  11.  \else
  12.    \usepackage[utf8]{inputenc}
  13.  \fi
  14. \fi
  15. \usepackage{color}
  16. \usepackage{fancyvrb}
  17. \DefineShortVerb[commandchars=\\\{\}]{\|}
  18. \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
  19. % Add ',fontsize=\small' for more characters per line
  20. \newenvironment{Shaded}{}{}
  21. \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
  22. \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
  23. \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  24. \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  25. \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  26. \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  27. \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  28. \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
  29. \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
  30. \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  31. \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
  32. \newcommand{\RegionMarkerTok}[1]{{#1}}
  33. \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  34. \newcommand{\NormalTok}[1]{{#1}}
  35. \usepackage{graphicx}
  36. % We will generate all images so they have a width \maxwidth. This means
  37. % that they will get their normal width if they fit onto the page, but
  38. % are scaled down if they would overflow the margins.
  39. \makeatletter
  40. \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
  41. \else\Gin@nat@width\fi}
  42. \makeatother
  43. \let\Oldincludegraphics\includegraphics
  44. \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
  45. \ifxetex
  46.   \usepackage[setpagesize=false, % page size defined by xetex
  47.               unicode=false, % unicode breaks when used with xetex
  48.               xetex,
  49.               colorlinks=true,
  50.               linkcolor=blue]{hyperref}
  51. \else
  52.  \usepackage[unicode=true,
  53.              colorlinks=true,
  54.              linkcolor=blue]{hyperref}
  55. \fi
  56. \hypersetup{breaklinks=true, pdfborder={0 0 0}}
  57. \setlength{\parindent}{0pt}
  58. \setlength{\parskip}{6pt plus 2pt minus 1pt}
  59. \setlength{\emergencystretch}{3em}  % prevent overfull lines
  60. \setcounter{secnumdepth}{0}
  61.  
  62.  
  63. \begin{document}
  64.  
  65. \section{Title}
  66.  
  67. This is an R Markdown document. Markdown is a simple formatting syntax
  68. for authoring web pages (click the \textbf{MD} toolbar button for help
  69. on Markdown).
  70.  
  71. When you click the \textbf{Knit HTML} button a web page will be
  72. generated that includes both content as well as the output of any
  73. embedded R code chunks within the document. You can embed an R code
  74. chunk like this:
  75.  
  76. \begin{Shaded}
  77. \begin{Highlighting}[]
  78. \KeywordTok{summary}\NormalTok{(cars)}
  79. \end{Highlighting}
  80. \end{Shaded}
  81. \begin{verbatim}
  82. ##      speed           dist    
  83. ##  Min.   : 4.0   Min.   :  2  
  84. ##  1st Qu.:12.0   1st Qu.: 26  
  85. ##  Median :15.0   Median : 36  
  86. ##  Mean   :15.4   Mean   : 43  
  87. ##  3rd Qu.:19.0   3rd Qu.: 56  
  88. ##  Max.   :25.0   Max.   :120
  89. \end{verbatim}
  90. You can also embed plots, for example:
  91. \begin{Shaded}
  92. \begin{Highlighting}[]
  93. \KeywordTok{plot}\NormalTok{(cars)}
  94. \end{Highlighting}
  95. \end{Shaded}
  96. \begin{figure}[htbp]
  97. \centering
  98. \includegraphics{figure/unnamed-chunk-2.png}
  99. \caption{plot of chunk unnamed-chunk-2}
  100. \end{figure}
  101.  
  102. \end{document}pandoc -s  -t latex -o report-2.tex