Subject: mailing-list for TeXmacs Users
List archive
From : Mėnulio Švytuoklė <address@hidden>- To: address@hidden
- Subject: Block of a code and long code listings
- Date: Sat, 4 Sep 2021 00:36:02 +0300
Hello.
Question is very short:
How to fit code block in width of a paper, and split long listing into
a few pages?
I have attached a problematic file, in order to show a burden, because
it is very hard to understand an exact problem.
Thank anyone who would help :)
Attachment:
problem.pdf
Description: Adobe PDF document
<TeXmacs|2.1>
<style|<tuple|generic|framed-program>>
<\body>
<doc-data|<doc-title|Problem>>
How to fit code block in width of a paper, and split long listing into a
few pages?
A problematic part:
An expected result is algorithm block splitted in pages.
<\algorithm>
<\python-code>
\;
print("=============DATABASES================")
\;
import mysql.connector
import matplotlib.pyplot as plt
\;
#mydb = mysql.connector.connect(
# \ host="192.168.1.4",
# \ user="user",
# \ password="passwd"
#)
\;
mydb = mysql.connector.connect(
\ \ host="localhost",
\ \ user="user",
\ \ password="password"
)
\;
table = 'DUS_2014'
\;
salary_f = []
salary_m = []
salary_fg = []
salary_mg = []
salary_fgSp = []
salary_mgSp = []
#list all databases:
cursor = mydb.cursor()
cursor.execute("SHOW DATABASES")
for x in cursor:
\ \ print(x[0])
cursor.execute("use works")
sql_f = 'select CB41 from %s where B21 = "F"'%(table)
cursor.execute(sql_f)
result_f = cursor.fetchall()
for i in result_f:
\ \ \ \ salary_f.append(float(i[0])/12.0)
sql_m = 'select CB41 from %s where B21 = "M"'%(table)
cursor.execute(sql_m)
result_m = cursor.fetchall()
for i in result_m:
\ \ \ \ salary_m.append(float(i[0])/12.0)
\;
edu = "G3"
age="30-39"
\;
sql_fg = 'select CB41 from DUS_2014 where B21 = "F" and B25 = "%s" and
B22_CLASS = "%s" and CB41\<less\>120000'%(edu, age)
sql_mg = 'select CB41 from DUS_2014 where B21 = "M" and B25 = "%s" and
B22_CLASS = "%s" and CB41\<less\>120000 '%(edu, age)
\;
cursor.execute(sql_fg)
result_fg = cursor.fetchall()
for i in result_fg:
\ \ \ \ salary_fg.append(float(i[0])/12.0)
cursor.execute(sql_mg)
result_mg = cursor.fetchall()
for i in result_mg:
\ \ \ \ salary_mg.append(float(i[0])/12.0)
\;
sql_fgSp = 'select CB42 from DUS_2014 where B21 = "F" and B25 = "%s"
and B22_CLASS = "%s" and CB41\<less\>120000'%(edu, age)
sql_mgSp = 'select CB42 from DUS_2014 where B21 = "M" and B25 = "%s"
and B22_CLASS = "%s" and CB41\<less\>120000 '%(edu, age)
\;
cursor.execute(sql_fgSp)
result_fgSp = cursor.fetchall()
for i in result_fgSp:
\ \ \ \ salary_fgSp.append(float(i[0]))
cursor.execute(sql_mgSp)
result_mgSp = cursor.fetchall()
for i in result_mgSp:
\ \ \ \ salary_mgSp.append(float(i[0]))
\;
\;
fig, ((ax0, ax1),(ax2, ax3)) = plt.subplots(2,2)
# ax0 - bendri alyginimai (vidutinis m\<#117\>nesio atlyginimas, gautas
vidutin\<#12F\> metin\<#12F\> padalinus i² 12-kos)
ax0.boxplot([salary_f, salary_m], showmeans=True, showfliers=False)
ax0.set_xticklabels(['F', 'M'])
ax0.set_title("Vidutinis m\<#117\>nesio atlyginimas")
ax1.boxplot([salary_fg, salary_mg], showmeans=True, showfliers=False)
ax1.set_xticklabels(['F', 'M'])
ax1.set_title("VDU (%s, %s)"%(edu, age))
\;
ax2.boxplot([salary_fgSp, salary_mgSp], showmeans=True,
showfliers=False)
ax2.set_xticklabels(['F', 'M'])
ax2.set_title("VDU Spalio (%s, %s)"%(edu, age))
fig.canvas.set_window_title('VDU 2014')
fig.tight_layout()
</python-code>
</algorithm>
</body>
<\initial>
<\collection>
<associate|page-medium|paper>
<associate|prog-scripts|python>
</collection>
</initial>
- Block of a code and long code listings, Mėnulio Švytuoklė, 09/03/2021
- Re: Block of a code and long code listings, Giovanni Piredda, 09/04/2021
Archive powered by MHonArc 2.6.19.