Text Formattinginserting code

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
teletubijs1
Posts: 13
Joined: Fri Dec 24, 2010 3:55 am

inserting code

Post by teletubijs1 »

When i copy pase code e.g.

Code: Select all

n<-length(mtcars$mpg)
r<-n/5;r
kvant<-qnorm(1:(r-1)/r,mean(mtcars$mpg),sd(mtcars$mpg)); kvant
sk<-c()
for (i in 1:(r)) sk[i]<-length(mtcars$mpg[mtcars$mpg<kvant[i]]); sk
Ni<-c()
Ni[1]<-sk[1]; Ni[2:(n/5)]<-diff(sk); Ni
T<-sum(((Ni-5)^2)/5); T
alpha<-0.05
kritiska_vertiba1<-qchisq(1-alpha,r-3); kritiska_vertiba1
into texmaker, output i get is more like all in one row. How can i avoid this without using \linebreak ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

inserting code

Post by frabjous »

What is this code form?

Use a verbatim environment, or perhaps the listings package?
teletubijs1
Posts: 13
Joined: Fri Dec 24, 2010 3:55 am

Re: inserting code

Post by teletubijs1 »

Program R
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

inserting code

Post by localghost »

Have you tried the listings package as suggested? Or minted?


Thorsten
Post Reply