[Tikzdevice-bugs] Error: "TeX capacity exceeded, sorry"

Mike Lawrence Mike.Lawrence at dal.ca
Wed Oct 28 21:02:09 CET 2009


Hi all,

Not sure if there's likely to be a work-around on this, but I'm trying
to create a figure for a manuscript and I've encountered a  "TeX
capacity exceeded, sorry" error when I try to render the pdf (
system("/usr/texbin/pdflatex kappa.tex",int=T) ). I'm guessing this
means that I don't have sufficient memory to render the pdf but I
thought I'd double-check with the list to make sure there aren't any
workarounds other than reducing the complexity of my figure or
upgrading my RAM.

Here's the code:

library(CircStats)
library(ggplot2)
library(tikzDevice)

#set some parameters
circle_resolution = 1 #1=very high res, but pdflatex fails; 10=lower
res but pdflatex succeeds
kappa = exp(seq(0,4,length.out=10))
x = seq(-180,180,circle_resolution)

#generate data to plot as circles
a = ldply(
	kappa
	, .fun = function(this_kappa){
		d = dvm(x*pi/180,0,this_kappa)
		d = d-min(d)
		d = d/max(d)
		to_return = data.frame(
			kappa = this_kappa
			, x = x
			, d = d
		)
		return(to_return)
	}
)

#get ready to make nice facet labels
temp = sort(unique(a$kappa))
temp = as.character(round(temp,1))
temp[1] = '1.0'
temp[9] = '35.0'

#make nice facet labels (this is why I'm using tikz)
a$kappa_print = factor(a$kappa,labels=paste('$\\kappa = ',temp,'$',sep=''))

#start making the plot
p = ggplot(
	data = a
	, mapping = aes(
		x = x
		, y = factor(1)
		, colour = d
		, fill = d
	)
)+facet_wrap(~kappa_print,ncol=5,as.table=FALSE)+
geom_bar(
	width=1
	,stat='identity'
)+scale_fill_gradient(
	low = muted('blue')
	, high = muted('red')
	, space = 'Lab'
)+scale_colour_gradient(
	low = muted('blue')
	, high = muted('red')
	, space = 'Lab'
)+scale_y_discrete(
	name=''
	,breaks=100
)+scale_x_continuous(
	name=''
	,breaks=0
)+coord_polar(
	theta='x'
)+opts(
	legend.position='none'
	, panel.grid.major = theme_blank()
	, panel.grid.minor = theme_blank()
	, axis.title.y = theme_blank()
	, axis.text.y = theme_blank()
	, axis.title.x = theme_blank()
	, axis.text.x = theme_blank()
	, axis.ticks = theme_blank()
)

#save using ggsave; works but can't get greek symbols in the facet
labels, even using plotmath
ggsave(p,file='kappa_ggsave.pdf',width = 10,height = 4.5)

#save using tikz
tikz("kappa_tikz.tex", width = 10,height = 4.5, standAlone =T)
print(p)
dev.off()

#this next step fails when circle_resolution=1 (on my machine with 2GB RAM)
system("/usr/texbin/pdflatex kappa_tikz.tex",int=T)


-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~


More information about the Tikzdevice-bugs mailing list