Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 蟒蛇蜕变为乳胶_Python_Python 3.x_Latex_Tex_Pweave - Fatal编程技术网

Python 蟒蛇蜕变为乳胶

Python 蟒蛇蜕变为乳胶,python,python-3.x,latex,tex,pweave,Python,Python 3.x,Latex,Tex,Pweave,我正在尝试以非逐字记录的形式生成一个LaTeX文件,以便我可以在文档中添加一些功能(徽标、脚注等)。 尽管我非常喜欢Pweave的易用性和便利性,但我一直无法做到这一点 Python 3.5.2(v3.5.2:4DEF2A2901A52016年6月26日10:47:25) [GCC 4.2.1(苹果公司建造5666)(dot 3)]关于达尔文 p版本为“0.25” 谁有线索 代码示例(为了便于说明,所有代码都在Python Pweave中): 谢谢 我从您的代码库中创建了示例源文件:一个是基于逐

我正在尝试以非逐字记录的形式生成一个LaTeX文件,以便我可以在文档中添加一些功能(徽标、脚注等)。
尽管我非常喜欢Pweave的易用性和便利性,但我一直无法做到这一点

Python 3.5.2(v3.5.2:4DEF2A2901A52016年6月26日10:47:25) [GCC 4.2.1(苹果公司建造5666)(dot 3)]关于达尔文 p版本为“0.25”

谁有线索

代码示例(为了便于说明,所有代码都在Python Pweave中):


谢谢

我从您的代码库中创建了示例源文件:一个是基于逐字记录的输出,另一个是使用Minted包进行语法高亮显示,这样您就可以看到区别了。唯一的区别在于在源代码中的其他包中添加了\usepackage{minted}

使用verbatim:test_pweave_verbatim.texw

\documentclass[a4paper,11pt,final]{article}
\usepackage{fancyvrb, color, graphicx, hyperref, amsmath, url}
\usepackage{palatino}
\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry}

\hypersetup
{   pdfauthor = {Name Surname},
  pdftitle={Simple test with Python and Matplotlib},
  colorlinks=TRUE,
  linkcolor=black,
  citecolor=blue,
  urlcolor=blue
}

\setlength{\parindent}{0pt}
\setlength{\parskip}{1.2ex}



\title{Simple test with Python and Matplotlib}
\author{Name Surname}
\date{12nd December 2016}

\begin{document}
\maketitle

\section{Introduction}

Just a simple example!


Plot stuff.

<<caption="Test!">>=
#' let's print
[print (i) for i in range(10)]

#' let's plot
#' we import the modules
import matplotlib.pyplot as plt
import numpy as np
#' we set the var x and y
x = np.arange(1,10,1)
y = x**2

#' we plot!
plt.plot(x,y, color= 'red')
plt.show()
@

\section{End}

A simple end.

\end{document}
\documentclass[a4paper,11pt,final]{article}
\usepackage{fancyvrb,color,graphicx,hyperref,amsmath,url}
\usepackage{palatino}
\usepackage[a4paper,text={16.5cm,25.2cm},居中]{geometry}
\超设置
{pdfauthor={姓名},
pdftitle={Python和Matplotlib的简单测试},
colorlinks=TRUE,
linkcolor=黑色,
城市颜色=蓝色,
urlcolor=蓝色
}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1.2ex}
\标题{使用Python和Matplotlib进行简单测试}
\作者{姓名}
\日期{2016年12月12日}
\开始{document}
\maketitle
\第{导言}节
只是一个简单的例子!
阴谋的东西。
=
#“我们打印吧
[范围(10)内的i打印(i)]
#“我们来策划吧
#“我们导入模块
将matplotlib.pyplot作为plt导入
将numpy作为np导入
#'我们设置变量x和y
x=np.arange(1,10,1)
y=x**2
#“我们策划!
plt.plot(x,y,颜色='红色')
plt.show()
@
\第{End}节
简单的结局。
\结束{document}
使用Minted突出显示语法:test_pweave_Minted.texw

\documentclass[a4paper,11pt,final]{article}
\usepackage{fancyvrb, color, graphicx, hyperref, amsmath, url}
\usepackage{minted}
\usepackage{palatino}
\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry}

\hypersetup
{   pdfauthor = {Name Surname},
  pdftitle={Simple test with Python and Matplotlib},
  colorlinks=TRUE,
  linkcolor=black,
  citecolor=blue,
  urlcolor=blue
}

\setlength{\parindent}{0pt}
\setlength{\parskip}{1.2ex}



\title{Simple test with Python and Matplotlib}
\author{Name Surname}
\date{12nd December 2016}

\begin{document}
\maketitle

\section{Introduction}

Just a simple example!


Plot stuff.

<<caption="Test!">>=
#' let's print
[print (i) for i in range(10)]

#' let's plot
#' we import the modules
import matplotlib.pyplot as plt
import numpy as np
#' we set the var x and y
x = np.arange(1,10,1)
y = x**2

#' we plot!
plt.plot(x,y, color= 'red')
plt.show()
@

\section{End}

A simple end.

\end{document}
\documentclass[a4paper,11pt,final]{article}
\usepackage{fancyvrb,color,graphicx,hyperref,amsmath,url}
\usepackage{minted}
\usepackage{palatino}
\usepackage[a4paper,text={16.5cm,25.2cm},居中]{geometry}
\超设置
{pdfauthor={姓名},
pdftitle={Python和Matplotlib的简单测试},
colorlinks=TRUE,
linkcolor=黑色,
城市颜色=蓝色,
urlcolor=蓝色
}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1.2ex}
\标题{使用Python和Matplotlib进行简单测试}
\作者{姓名}
\日期{2016年12月12日}
\开始{document}
\maketitle
\第{导言}节
只是一个简单的例子!
阴谋的东西。
=
#“我们打印吧
[范围(10)内的i打印(i)]
#“我们来策划吧
#“我们导入模块
将matplotlib.pyplot作为plt导入
将numpy作为np导入
#'我们设置变量x和y
x=np.arange(1,10,1)
y=x**2
#“我们策划!
plt.plot(x,y,颜色='红色')
plt.show()
@
\第{End}节
简单的结局。
\结束{document}
现在,使用以下命令生成pdf文件:

  • 逐字记录

    • pweave-f tex test_pweave_verbatim.texw
    • pdflatex测试_pweave_verbatim.tex
  • 铸造

    • pweave-f texminted test_pweave_minted.texw
    • pdflatex-外壳逸出试验

  • 使用Python2.7.10和Pweave 0.25在OSX 10.11.4中进行了测试。

    谢谢,不幸的是,我无法使它与结果和所有这些一起工作。我的主要问题是,使用weave(“文件路径”)运行我的文件会产生一个html,但我需要一个tex文件,这样我就可以进一步处理它,比如添加其他文件、节和子节编号、徽标等。作为旁注,我试着从org mod生成emacs,但我发现它实际上不够可预测。另外,我希望能够从IDE直接使用python,而不是处理会话和长文件。就我所知,组织模式似乎并没有读weave。您的文件是否有.texw扩展名?您是否尝试运行以下命令来生成tex文件:pweave-f tex yourfile.texw现在我想我明白了我的问题所在,谢谢您与我在一起:我需要从我的python代码创建.texw文件。我如何到达那里?正如您在我的示例中所看到的,.texw文件只是一个.tex文件,您可以在其中插入一些代码。
    \documentclass[a4paper,11pt,final]{article}
    \usepackage{fancyvrb, color, graphicx, hyperref, amsmath, url}
    \usepackage{minted}
    \usepackage{palatino}
    \usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry}
    
    \hypersetup
    {   pdfauthor = {Name Surname},
      pdftitle={Simple test with Python and Matplotlib},
      colorlinks=TRUE,
      linkcolor=black,
      citecolor=blue,
      urlcolor=blue
    }
    
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{1.2ex}
    
    
    
    \title{Simple test with Python and Matplotlib}
    \author{Name Surname}
    \date{12nd December 2016}
    
    \begin{document}
    \maketitle
    
    \section{Introduction}
    
    Just a simple example!
    
    
    Plot stuff.
    
    <<caption="Test!">>=
    #' let's print
    [print (i) for i in range(10)]
    
    #' let's plot
    #' we import the modules
    import matplotlib.pyplot as plt
    import numpy as np
    #' we set the var x and y
    x = np.arange(1,10,1)
    y = x**2
    
    #' we plot!
    plt.plot(x,y, color= 'red')
    plt.show()
    @
    
    \section{End}
    
    A simple end.
    
    \end{document}