Text FormattingMaking a ' which looks nice

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
thedreamshaper
Posts: 44
Joined: Wed Aug 04, 2010 7:00 pm

Making a ' which looks nice

Post by thedreamshaper »

As some of you may have gathered from my recent posts i am writting my statistics notes in LaTex and also the R code which goes along with that course. In R you use the symbol ' alot, which in latex could be made using \prime, however this is very ugly and seems to distrup the lines, do any one outthere have a fix ? if so, thanks :)


ps. if you just make a regular ' in the document it will come out as a ´ which wont work when you paste it into your R code.
Last edited by thedreamshaper on Thu Sep 16, 2010 3:54 pm, edited 1 time in total.

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

Making a ' which looks nice

Post by frabjous »

\textquotesingle from the textcomp package?

Or better yet, load the listings package and have it do the dirty work:

Code: Select all

    \begin{lstlisting}[language=R,upquote=true]
        'a'=b
    \end{lstlisting}
thedreamshaper
Posts: 44
Joined: Wed Aug 04, 2010 7:00 pm

Making a ' which looks nice

Post by thedreamshaper »

Thank you, Listings didnt actually work(' still came out as ´), but \textquotesingle works fine, its a bit more work and i have to use verbatim but it looks right :)

Code: Select all

\begin{verbatim}
par(mfrow=c(3,3))
n<-sum(!is.na(data))
for (i in 1:6) \end{verbatim}
{
	cat( \textquotesingle plot nr: \textquotesingle ,i, \textquotesingle  \ n \textquotesingle ) \begin{verbatim}
	x<-rnorm(n)
	qqnorm(x)
	qqline(x)
} \end{verbatim}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Making a ' which looks nice

Post by localghost »

Now that the problem seems to be solved, please be so kind and mark the topic accordingly as clearly described in Section 3 of the Board Rules (to be read before posting). Otherwise please tell us what is missing. This applies to all your former requests.


Best regards
Thorsten
Post Reply