I know I can use "prefer to infinitive" and "prefer ~ing".

And when I use "prefer ~ing", we use "to" to compare.

> 
> 1. I prefer ***studying at a coffee shop*** to ***studying in the library***.
> 
> 
> 

Then, how about "prefer to infinitive"?

> 
> 2. I prefer ***to study at a coffee shop*** to ***to study in the library.***
> 
> 
> 

I think it sounds not correct. rather I would use like this:

I prefer ***to study at a coffee shop*** rather than ***studying in the library.***

Is there any other option for this? Or, is my suggestion the best choice?