2017-03-11 2 views
1

私はマークダウンを実行したい、次のコードを持っています。私はLaTeXコンパイラで実行しようとしましたが、これは絶対にうまく動作します。しかし、Rマークダウンに追加すると、コードをコンパイルしません。RマークダウンはLaTeXコードをコンパイルしません

--- 
title: "Titre" 
date: Fecha 
output: 
pdf_document: 
    keep_tex: true 
    includes: 
    in_header: mystyle.sty 


--- 



\begin{table}[!htbp] \centering 
    \caption{} 
    \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} } 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
& \multicolumn{1}{c}{\textit{Dependent variable:}} \\ 
\cline{2-2} 
\\[-1.8ex] & \multicolumn{1}{c}{mpg} \\ 
\hline \\[-1.8ex] 
cyl & -2.876^{***} \\ 
    & (0.322) \\ 
    & \\ 
Constant & 37.885^{***} \\ 
    & (2.074) \\ 
    & \\ 
    \hline \\[-1.8ex] 
Observations & \multicolumn{1}{c}{32} \\ 
R$^{2}$ & \multicolumn{1}{c}{0.726} \\ 
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.717} \\ 
Residual Std. Error & \multicolumn{1}{c}{3.206 (df = 30)} \\ 
F Statistic & \multicolumn{1}{c}{79.561$^{***}$ (df = 1; 30)} \\ 
\hline 
\hline \\[-1.8ex] 
\textit{Note:} & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
\end{tabular} 
\end{table} 

ファイルmystyle.styは、以下の

\usepackage{dcolumn} 
\newcolumntype{d}[1]{D{.}{.}{#1}}  
\usepackage{booktabs} 
\newcommand{\mc}[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro 
\usepackage{verbatim} 

が含まれているRの値下げは、上記の何をコンパイルすることはできません理由を説明できる人はありますか?

答えて

2

テーブルコードを1行ずつ追加して毎回再コンパイルすることで、問題をキャレット付きの行に分離しました。行はcyl & -2.876^{***} \\となります。

私はすなわち

cyl & -2.876$$^{***}$$ \\ 

、2つの$兆候で上付き文字の部分を囲むことによって、ドキュメントをコンパイルすることができました(あなたは2を必要とする理由私はむしろちょうど1、$よりも、わかりません。)

これはうまくコンパイルされます:

--- 
title: "Titre" 
date: Fecha 
output: 
pdf_document: 
    keep_tex: true 
    includes: 
    in_header: mystyle.sty 
--- 

\begin{table}[!htbp] \centering 
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} } 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
& \multicolumn{1}{c}{\textit{Dependent variable:}} \\ 
\cline{2-2} 
\\[-1.8ex] & \multicolumn{1}{c}{mpg} \\ 
\hline \\[-1.8ex] 
cyl & -2.876$$^{***}$$ \\ 
& (0.322) \\ 
& \\ 
Constant & 37.885$$^{***}$$ \\ 
& (2.074) \\ 
& \\ 
\hline \\[-1.8ex] 
Observations & \multicolumn{1}{c}{32} \\ 
R$^{2}$ & \multicolumn{1}{c}{0.726} \\ 
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.717} \\ 
Residual Std. Error & \multicolumn{1}{c}{3.206 (df = 30)} \\ 
F Statistic & \multicolumn{1}{c}{79.561$^{***}$ (df = 1; 30)} \\ 
\hline 
\hline \\[-1.8ex] 
\textit{Note:} & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
\end{tabular} 
\end{table} 
関連する問題