簡體   English   中英

使用knitr和LateX,如何避免.png以上的路徑; 以及如何在表格中並排放置兩個地塊

[英]With knitr and LateX, how to avoid path above .png; and how to place two plots side-by-side in table

LateX的新手,它或knitr有兩個問題。 運行跟隨PDF產生的圖像的代碼,.png圖上方的路徑繼續出現三個重復。

其次,每個都沒有.png圖像的並排表根本不會出現。

我將不勝感激得到糾正和教育。

在此處輸入圖片說明

\documentclass[11pt]{article}  

\usepackage{fullpage}
\usepackage[margin=1in]{geometry}

\usepackage{color}

% \usepackage{framed}

\usepackage{graphicx}  % to import .png files
\usepackage{tabularx}  % note that there is no tabular package
\usepackage{fancyhdr}

\lhead{Survey Graphics}
\rhead{Pg. \thepage}
\cfoot{$\copyright$ lawyeR}

<<echo=FALSE, results="hide", warning=FALSE, message=FALSE>>=
lm_blue <- "#003767"
@

% \renewcommand
% \headrule{ 
% \color{lm_blue}
% \begin{minipage}{1\textwidth}
% \hrule width \hsize height 5pt 
% \end{minipage}}%
% 
% \newcommand{\HRule}[1]{\hfill \rule{0.2\linewidth}{#1}} % Horiz rule at bottom of page, adjust width here
% 
% \renewcommand{\headrulewidth}{0.4pt}
% \renewcommand{\footrulewidth}{0.1pt}  
% \addtolength{\headheight}{0.5pt}  

%% end preamble; begin document


\begin{document}

\graphicspath{ {C:/Users/blank/Documents/Marketing and Blog/ReproData Book Survey/Plots and images/} }

\begin{figure}[h]    
\begin{center}
\includegraphics[width = 90mm, height = 2in]{C:/Users/blank/Documents/Marketing and Blog/ReproData Book Survey/Plots and images/Above the Law 2013 comment in plot.PNG}
\end{center}
\end{figure}


% lay out figures side-by-side using table

\begin{table}[h]
\begin{tabular}{cc}
PNG One & PNG Two \\
\includegraphics[width = 20mm]{C:/Users/blank/Documents/Marketing and Blog/ReproData Book Survey/Plots and images/MLA Comp 2014 bars separated.PNG} &
\includegraphics[width = 20mm]{C:/Users/blank/Documents/Marketing and Blog/ReproData Book Survey/Plots and images/Winstonpg19noredundantdata2.PNG}
\end{tabular}
\end{table}

\end{document}

文件名中有空格,您需要添加

\usepackage{grffile}

到你的序言。 此外,在\\graphicspath{..}指定了適當的設置后,您可以在\\includegraphics命令中刪除所有此類路徑引用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM