TeX - LaTeX Asked by Ruben deV on January 18, 2021
Basically I am trying to add some code to my document, and no matter what I try to do, these white lines won’t go..
I don’t seem to be the only one struggling with this as I found this question, Listings code snippet has white horizontal lines across it, but trying the solution there didn’t fix my issue. No matter what size options I choose, the white lines stay.
I am using miktex with pdflatex. I also tried with xetex and lualatex but that hasn’t helped the issue either.
Hopefully someone can help me with this. All of the relevant code below…
documentclass{report}
usepackage{amsmath}
usepackage[utf8]{inputenc}
usepackage[dutch]{babel}
usepackage{siunitx}
usepackage{url}
usepackage{titlesec}
usepackage{graphicx}
usepackage{cancel}
usepackage{caption}
usepackage{subcaption}
usepackage{tensor}
usepackage{listings}
usepackage{textcomp}
usepackage{xcolor}
usepackage{tcolorbox}
definecolor{codegray}{HTML}{F8F8F2}
definecolor{codestring}{HTML}{FFFFB6}
definecolor{codenormal}{HTML}{F8F8F2}
definecolor{codekeyword}{HTML}{FBB036}
definecolor{codecomment}{HTML}{5C98CD}
definecolor{backcolour}{HTML}{2B3E50}
lstdefinestyle{mystyle}{
backgroundcolor=color{backcolour},
commentstyle=color{codecomment},
keywordstyle=color{codekeyword},
numberstyle=tinycolor{codegray},
stringstyle=color{codestring},
basicstyle=ttfamilyfootnotesizecolor{codenormal},
breakatwhitespace=false,
breaklines=false,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
lstset{style=mystyle}
newcommand{sectionbreak}{}
newcommand{uvec}[1]{underline{#1}}
newcommand{uuvec}[1]{hat{underline{#1}}}
newcommand{icol}[1]{% inline column vector
left[begin{matrix}#1end{matrix}right]%
}
newcommand{irow}[1]{% inline row vector
begin{matrix}[#1]end{matrix}%
}
usepackage{geometry}
geometry{
a4paper,
total={150mm,227mm},
left=30mm,
top=35mm,
}
titleformat{chapter}[display]
{normalfontsffamilyLargebfseriesraggedleft}
{chaptertitlename thechapter}{0pt}{Huge}
titlespacing{chapter}{0pt}{0pt}{0pt}
% ------ einde chapter headings aanpassen
begin{document}
chapter*{Huiswerk Week 4}
%some irrelevant document code here...
section*{Python Code}
begin{lstlisting}[language=Python]
# -*- coding: utf-8 -*-
'''
Created on Wed Sep 23 13:49:15 2020
'''
import numpy as np
import math as m
import sympy as s
s.init_printing(use_latex=True, forecolor='White')
def latex(obj):
print(s.latex(obj))
# ----- define symbols for symbolic maths -----
# alle symbolen hier, dus ook voor latere opgaves
psi = s.Function('\psi')('t')
phi = s.Function('\varphi')('t')
theta = s.Function('\theta')('t')
psi_dot = s.Function('\dot{\psi}')('t')
phi_dot = s.Function('\dot{\varphi}')('t')
theta_dot = s.Function('\dot{\theta}')('t')
omegax = s.Symbol('\omega_{x}')
omegay = s.Symbol('\omega_{y}')
omegaz = s.Symbol('\omega_{z}')
px = s.Symbol('p_x')
py = s.Symbol('p_y')
pz = s.Symbol('p_z')
alias = {psi.diff('t'):psi_dot, phi.diff('t'): phi_dot, theta.diff('t'): theta_dot}
# ----- rotatie matrices hier -----
fCn_np = np.array([[s.cos(psi), s.sin(psi), 0],
[-s.sin(psi), s.cos(psi), 0],[0,0,1]])
fCn = s.Matrix(fCn_np)
gCf_np = np.array([[s.cos(theta), 0, -s.sin(theta)],[0,1,0],
[s.sin(theta), 0, s.cos(theta)]])
gCf = s.Matrix(gCf_np)
bCg_np = np.array([[1,0,0],[0, s.cos(phi), s.sin(phi)],
[0, -s.sin(phi), s.cos(phi)]])
bCg = s.Matrix(bCg_np)
# ----- nodige vector definities hier -----
g_g1_np = np.array([1,0,0])
g_g1 = s.Matrix(g_g1_np)
f_f2_np = np.array([0,1,0])
f_f2 = s.Matrix(f_f2_np)
n_n3_np = np.array([0,0,1])
n_n3 = s.Matrix(n_n3_np)
# ----- calculating angular velocities here for deel 1.c. -----
b_w_bn =( (phi_dot * bCg * g_g1) + (theta_dot * bCg * gCf * f_f2) +
(psi_dot * bCg * gCf * fCn * n_n3))
# ----- deel 1.d. -----
res = s.solve((b_w_bn[0] - omegax, b_w_bn[1] - omegay, b_w_bn[2] - omegaz),
(psi_dot, theta_dot, phi_dot))
# ----- deel 1.h. -----
# definities van nodige rotatie matrices en vectoren [.T neemt de getransponeerde]
b_r_pc = s.Matrix(np.array([px,0,0]))
gCb = bCg.T
fCg = gCf.T
nCf = fCn.T
g_r_pc = gCb * b_r_pc
f_r_pc = fCg * gCb * b_r_pc
n_r_pc = nCf * fCg * gCb * b_r_pc
# ----- deel 1.i. -----
# N triad
def ntriad():
n_dr_pc = s.diff(n_r_pc, 't')
n_w_nn = s.Matrix([0,0,0]) # geen rotatie matrix
n_dr_n = (n_dr_pc + n_w_nn.cross(n_r_pc)).subs(alias)
return s.simplify(n_dr_n)
# F triad
def ftriad():
f_w_fn = fCn*(psi_dot*n_n3)
f_dr_pc = s.diff(f_r_pc, 't')
f_dr_n = (f_dr_pc + f_w_fn.cross(f_r_pc))
n_dr_n = (nCf*f_dr_n).subs(alias)
return s.simplify(n_dr_n)
# G triad
def gtriad():
g_w_gn = theta_dot*gCf*f_f2 + psi_dot*gCf*fCn*n_n3
g_dr_pc = s.diff(g_r_pc, 't')
g_dr_n = (g_dr_pc + g_w_gn.cross(g_r_pc))
n_dr_n = (nCf*fCg*g_dr_n).subs(alias)
return s.simplify(n_dr_n)
# B triad
def btriad():
# b_w_bn is al gedefinieerd in deel c
b_dr_pc = s.diff(b_r_pc, 't')
b_dr_n = (b_dr_pc + b_w_bn.cross(b_r_pc))
n_dr_n = (nCf*fCg*gCb*b_dr_n).subs(alias)
return s.simplify(n_dr_n)
end{lstlisting}
end{document}
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP