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
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
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: 9201
Joined: Fri Feb 02, 2007 12:06 pm

inserting code

Post by localghost »

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


Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Post Reply