FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-sty/example.tex at master · hgrecco/python-sty · GitHub
hgrecco
/
python-sty
Public
forked from
brotchie/python-sty
Notifications
You must be signed in to change notification settings
Fork
7
Star
21
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-sty
/
example.tex
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (39 loc) · 1.01 KB
Breadcrumbs
python-sty
/
example.tex
Copy path
File metadata and controls
47 lines (39 loc) · 1.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
\documentclass
{
article
}
\usepackage
{
python
}
\usepackage
{
amsmath
}
\title
{Example Use of python.sty}
\author
{James Brotchie
\emph
{
j.brotchie@gmail.com
}}
\begin
{
document
}
\maketitle
$
N
\times
N
$
element identity matrices for
$
N
\in
\{
1
,
2
,
\ldots
,
5
\}
$
:
\begin
{
python
}
def identity(n):
""
"
Generates and returns the LaTeX code for
a n x n identity matrix.
""
"
return
'\n'
.join([
r'
\left
[',
r'
\begin
{
array
}{
%
s}' % (n*'c',),
'\\\\'
.join('&'.join('1' if i==j else
'0'
for j in range(n))
for i in range(n)),
r'
\end
{array}',
r'
\right
]',
])
# Displays identity matrices for
# n
\in
{1, 2, ..., 5}.
print
'\n'
.join([
r'
\begin
{
equation*
}
',
r'
\begin
{
array
}{
%
s}' % (5*'c',),
'&'
.join(identity(i) for i in range(1,6)),
r'
\end
{array}.',
r'
\end
{equation*}',
])
\end
{python}
\begin
{
python
}
# Create a deliberate exception.
print
'This text will be displayed.'
print 1/0
print
'This text won\'
t be displayed.'
\end
{
python
}
\end
{
document
}
Back
|
FazBrowse Home
|
New Git URL