Different \chi symbols in LaTeX - latex

I am typesetting a LaTeX document with some Greek symbols, using the xelatex engine.
For some reason, the \chi command creates a different symbol than I would expect:
versus
They are close, but not exactly the same, and I would like to obtain the second.
Is there a special package that I should invoke?
Thanks in advance for any hint,
Adrian

Remove any font changing packages from the preamble.
In this case it turned out that the offending one was mathptmx.

Related

Why Special Characters dont show in my pdf in latex

i have a problem outputing special characthers in latex even tho im using latin packages
Did you try using the escaped version (ie. \'e ,\`a ...) ? Without any MWE it will be hard to help you more than this.

latex: footnote in glossaries entry

I need help with the latex glossaries package. I just need a footnote within a glossary entry.
Example:
\newglossaryentry{glos:vo}{
name=ValueObject,
description={a very good explanation for valueObject\footnote{S.89ff \cite{aBookInBibliography}}.}}
Texmaker refuses to build PDF. The log file is confusing as always, saying something like this:
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Too many }'s.
So any ideas here? Thank you.
i've got it. it has not been the fault of the footnote or cite. it turned out, my description text has been to long.
whysoever latex accepts description texts just with 1024 characters maximum.

Icelandic, utf8 and utf8x in LaTeX

First of all, what's the difference between utf8 and utf8x in
\usepackage[utf8]{inputenc}
\usepackage[utf8x]{inputenc}
when used in LaTeX?
Secondly, what packages are required when writing an article in Icelandic using LaTeX? I found:
\usepackage[icelandic]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
after experimenting a bit but I have a feeling some part of the code may be redundant. And even with them the aforementioned packages, the code inside
\begin{lstlisting}
...
\end{lstlisting}
isn't rendered with Icelandic characters when outputted through pdflatex in Ubuntu, although it works on my friend's computer (who's running Debian). What's missing?
[UTF8] is "supported" by the LaTeX team and covers a fairly specific/limited range of unicode input characters. It only defines those symbols that are known to be available with the current font encoding.
[UTF8x], AFAIK, is no longer supported, but covers a much broader range of input symbols. I would recommend only trying it if [UTF8] doesn't do what you need.
Secondly, the listings package (and most other related packages that do character scanning) does not support UTF8 input. (If it's working on a friend's machine they must be using an 8-bit input encoding instead.) The listingsutf8 package provides a UTF8-compatible replacement for \lstinputlisting but not for the main lstlisting environment. Using XeLaTeX might help you here, however.

How do I enter a multi-line footnote in LaTeX?

My intuition was
Lorem ipsum\footnote{long footnote
that spans a whole
bunch of
lines.
}
But regardless of where I put the { and } in relation to the footnote text, I get the following error:
Latex Error: ./mydoc.tex:142 Package inputenc Error: Unicode char \u8:― not set up for use with LaTeX.
Footnotes are filled in the availible space just like any other paragraph: you just write
\footnote{
a whole lot of text that goes on and on and on and...
...
and may consists of multiple sentences. But after a while
...
it finally comes to a stop.
}
That is not your problem. looking at the error message (which I don't recognize from personal experience), I'd say your problem is character set or font related.
Is you editor using unicode?
The error you're getting indicates there's a coding setup issue. Googling the error message suggests you may be running TexShop, or you need to install latex unicode support. use
apt-get latex-ucs
or something similar and try it again.
I get this error a lot when I cut text from another document and paste into LaTeX. My plain text editor doesn't warn me that I pasted in some bad character. Although it is tedious, you can
comment out the entire text of your footnote, replace it by XX, and confirm that now your document runs
retype the entire text of your footnote by hand.
This always works for me. As a shortcut, you may be able to see a punctuation mark that is the culprit and simply fix that.
In the example you gave, it looks like maybe you got an em-dash character that needs to be replaced by the standard LaTeX construction of two or three hyphens.

How do you display straight quotes instead of curly quotes when using LaTeX's 'listings' package?

I'm using LaTeX's "listings" package to format source code. Unfortunately I get curly quotes instead of straight quotes. Since the curly quotes don't always point in the right direction, it looks bad. How can I get straight quotes instead?
I'd prefer not to change or filter the source code itself. Filtering the code to properly change " to `` or '' would work, but this is easier done than said with multiple quotes on a line, or quotes spanning multiple lines. Or you could use symbol or a host of other things. But I'd really like to keep the source unchanged.
Example LaTeX:
\documentclass{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}
Fahrenheit=input("What is the Fahrenheit temperature?")
Celsius=(5.0/9.0)*(Fahrenheit-32)
print"The temperature is",Celsius,"degrees Celsius"
\end{lstlisting}
\end{document}
Example output (using Miktex on windows):
(Direct link to image of incorrect output)
I see in the documentation (which should have been distributed with the packge, but is available at http://www.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf) for listings that there is a settable property called upquote to take care of this.
From the documentation:
upquote=⟨true|false⟩ false
determines whether the left and right quote are printed ‘’ or `'. This
key requires the textcomp package if true.
Do something like
\lstset{upquote=true}
before begining the list environment, or use
\begin{lstlisting}[upquote=true]
...
\end{lstlisting}
It is also possible that tis property is already set for you in the appropriate language
definition (see the docs again, big list of predefined languages on page 12).
Use:
\lstloadlanguages{<dialects you need>}
in the header. And then set the language using either of the above conventions for choosing options.
Have you considered using a monospaced (typewriter) font for the listing? The following example works:
\documentclass{article}
\usepackage{listings}
\lstset{basicstyle=\ttfamily} % <<< This line added
\begin{document}
\begin{lstlisting}
Fahrenheit=input("What is the Fahrenheit temperature?")
Celsius=(5.0/9.0)*(Fahrenheit-32)
print"The temperature is",Celsius,"degrees Celsius"
\end{lstlisting}
\end{document}
dmckee's answer above probably works. If you drop your last condition, i.e. you permit changes to the code, then there is a more generic solution, which I tend to use whenever (La)TeX renders a character somehow differently than I expect it to do is to use the \symbol command. I list it here because it can be useful in other situations as well:
\newcommand{\qq}{\symbol{34}} % 34 is the decimal ascii code for "
And then your example:
\begin{lstlisting}
...
print{\qq}The temperature is{\qq},Celsius,{\qq}degrees Celsius{\qq}
...
\end{lstlisting}
Note the curly braces which supposedly take listings back to LaTeX mode (see escapechars option of the package.)
Here is a solution
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}
% in the listings package configuration, try:
literate={"}{\textquotedbl}1,
I had the same problem, using fontspec, and the solution was to not set \defaultfontfeatures{Mapping=tex-text}, but instead setting Mapping=tex-text specifically on only the main and sans font, and leaving the tt font to it's own devices. :)
Maybe it's because I installed listings early as a LaTeX user, but I'm surprised to learn that without the listings package the behaviour is any different.
My solution was similar to David Hanak's, but I used the symbols for double-quote as described in the LaTeX Cheat Sheet (http://stdout.org/~winston/latex)
\newcommand{\QQ}[1]{``#1''}

Resources