accented characters in latex - latex

I am writing a document in spanish, and I'm trying to add 'í' to the word
Montréal.However if I put the i like this: \'{e} in the code below, I just get a space instead of the é. Why is this not working?
\begin{tabbing}%
\hspace{2.3in}\= \hspace{2.6in}\= \kill % set up two tab positions
{\bf Engineer}\> Panagro S.A.\> Summers 2004-2010\\
\>Montréal, Colombia
\end{tabbing}\vspace{-15pt}
Also I might add that when I try putting Montréal outside of the tabbing block, it works fine.
Ted

Tabbing environment
Some of the accent marks used in running text have other uses in the tabbing environment. In that case they can be created with the following command:
\a' for an acute accent
\a` for a grave accent
\a= for a macron accent
source: LaTeX/Accents at Wikibooks

Related question on tex.stackexchange with a great solution to accented characters.
Save your file as UTF-8 and put
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
in your preamble.
Then you can just type the characters normally into your source file.
Or, use XeLaTeX which accepts UTF-8 input natively. In that case you need to add
\usepackage{fontspec}
to your preamble.
If your text editor doesn't support UTF-8 encoded files, you should probably get another editor. But if you're stuck with one, you can also use:
\usepackage[latin1]{inputenc} % for PCs
\usepackage[applemac]{inputenc} % for Macs
and save the files in the default encoding for your machine.
Thanks to Alan Munn for the solution!

Related

Latex ClassicThesis - The numbering of the paragraphs does not appear

I need one more numbered level for my report. I used \paragraph{title} but it only appears without numbering.
In the config file, the paragraph is described as:
\titleformat{\paragraph}[runin]
{\normalfont\normalsize}{\theparagraph}{0pt}{\spacedlowsmallcaps}
I believe that the command \theparagraph is responsible for the numbering. Why doesn't it appear?
I searched the net for answers and tried the following commands (at once) before the beginning of the document:
\setcounter{secnumdepth}{\paragraphnumdepth}
Replace the previous command to get rid of run-in with:
\titleformat{\paragraph}
{\relax}{\textsc{\MakeTextLowercase{\theparagraph}}}{1em}{\normalsize\itshape}
\renewcommand{\theparagraph}{\thesubsection.\arabic{paragraph}}
I put the last two commands in \makeatletter and \makeatother.
The paragraph name appears like the section names now, but still no numbers. Any ideas? Here is a small example that works because I didn't include the classicthesis config files.
\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{\paragraphnumdepth}
\begin{document}
\chapter{Chapitre}
\section{Introduction}
\subsection{Première sous-partie}
\subsubsection{Un cran en dessous}
\paragraph{Paragraphe with number: what I would like in my report}
Functional here because the problem clearly comes from the two classicthesis config files...
\end{document}
Thank you

How to automatic break lines in latex?

I have searched but nothing useless, only "use \newline" or "use \".
I'm creating a simple latex document to store any texts instead of using .txt, and the problem is that the pdf document contains the lines going towards right until they go out of the paper.
I'm using this simple code
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlabore etdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.Duisauteiruredolorinreprehenderitinvoluptatevelitessecillum doloreeufugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Since latex sees it as a one word, it refuses to break it since it doenst know its hyphenation. But I would like to allow latex to break it regardless. Any thoughts ?
Remarks: I already have used:
\hspace{0pt}
\leavevmode\nobreak\hspace{0pt}
\mbox{Loremip...larorum.}
Nothing worked.
I think I got why nothing worked. See my code below, that I managed to compile successfully after editing your MWE.
You basically have two ways to force hyphenation here.
As in the comment by SamCarter, you manually split words within text, just using \- where necessary. I did it below in line 18 (6 from bottom).
You add to your preamble the command \hyphenation{word-to-split}: I did this below to hyphenate the word in line 20 (4 from bottom). Notice that, in this case, you use - instead of \- within the braces {} enclosing the argument.
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\hyphenation{Duisauteiruredolorinre-prehenderitinvoluptatevelitesse-cillum doloreeufugiatnullapariatur}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet, consecteturadipiscingelit,
seddoeiusmodtemporincididuntutlaboreetdoloremagna.
Uten\-imadminimveniam,
quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.
Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariatur.
Excepteursintoccaecatcupidatatnonproident,
suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Finally, if the full stop character . is not followed by a space, two separate words may be interpreted as one and the command \hyphenation may not work as expected. Not sure that this was the detail making you write that nothing worked, but be careful to this too.

Formatting of Strings in Latex in whitespace insensitive environment / Z-Notation Schema

I'm using latex to model a few functions using Z-Notation, however, I'm having issues showing a string for output. In this reduced example code, the text in the quotes has a different formatting from what I would expect. What can I use to keep the formatting the text inside the quotes to be the same in the code snippet?
Edit: The overDraftMessage should be messageOutput, missed changing this when creating a reduced example.
\documentclass{article}
\usepackage{oz} % oz or z-eves or fuzz styles
\begin{document}
\begin{schema}{function}
messageOutput!: $STRING$ \\
\where
messageOutput! = ''Output looks strange.'' \\
\end{schema}
\end{document}
Solution from #lburski works, but tilde is not for this purpose. It should be used to make hard space (non-breaking space). To write space in whitespace insensitive environments, you need to escape it - write backslash before every space: ''Output\ looks\ strange''.
If you want a space between the words on your string ''Output looks strange.'' then try putting a tilde '~' between those words. So you string ends up being ''Output~looks~strange.''

Problem with theorem decimal numbering in LaTeX

Below is the beginning of my LaTeX code. When I compile, theorem numbers do not show the decimal point. For example, the output shows Theorem 11 instead of Theorem 1.1. How can I fix this ?
\documentclass[smallcondensed]{svjour3}
\smartqed
\usepackage{graphicx}
\usepackage{mathptmx}
\usepackage{amssymb,amsmath,amsfonts,latexsym}
\usepackage{tikz}
\newtheorem{thm}{Theorem}[section]
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{defn}[thm]{Definition}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{clm}[thm]{Claim}
\newtheorem{fact}[thm]{Fact}
\newtheorem{lem}[thm]{Lemma}
it looks like this is a setting of the style file you are using (svjour3)
in the version i found here, line 804 contains the line
\def\#thmcountersep{}
which removes the separator. if you want you can add back the period ( \def\#thmcountersep{.} ) but if the style file was provided by a journal their default is probably their default. it may be worth having a look at some example articles from the journal
Have you tried putting a backslash before the period? Perhaps '.' serves some special function when you make theorems.

How to write programming code containing the ' character in latex?

I am trying to write programming code in latex using the verbatim environment, but when I write
\begin{verbatim}
char ch = 'x';
\end{verbatim}
then the ' -characters around x are displayed incorrectly (they look "curly"). How can I fix this problem?
Load the upquote package to fix this issue in verbatim mode.
If you want straight quotes in monospaced text mode (e.g., \texttt{...}), or indeed in any other font, then you can use the \textquotesingle command defined in the textcomp package:
\documentclass{article}
\usepackage{upquote,textcomp}
\begin{document}
\newcommand\upquote[1]{\textquotesingle#1\textquotesingle}
\verb|'c'| \texttt{\upquote{h}}
\textsf{\upquote{h}} \upquote{h}
\end{document}
This will work well for fonts in any encoding rather than depending on a specific glyph slot (such as \char13 in the default OT1 encoding).
Adding \usepackage{upquote} to my preamble was sufficient.
Perhaps older versions of LaTeX or upquote required more work.
I have
What is wrong?
New
If you want to get something like this
write
\makeatletter
\let \#sverbatim \#verbatim
\def \#verbatim {\#sverbatim \verbatimplus}
{\catcode`'=13 \gdef \verbatimplus{\catcode`'=13 \chardef '=13 }}
\makeatother
For displaying source code, you might consider using the listings package; it is quite powerful and offers an option to display “straight” quotation marks.
If you're seeing curly single right quotes in a verbatim environment, then the single right quote in your typewriter font is curly, and that's the correct one to use for what you're doing (which I assume is displaying some C code).
\textsf{``} and \textsf{''} come pretty close to straight quotes. No need for using any special packages.
This is what I got from another source, and this works.
Use `` to start the double quotes (this symbol is below ~ symbol on our keyboard)
Use '' to close the double quotes (this symbol is below the " symbol on our keyboard)
So, `` quote double, unquote double''
Same goes for single quotes, `quote single, unquote single'

Resources