I am attempting to compile my latex file and I have a source with author's last name with an accent mark (two dots above the letter o). In the preamble of my file, I have
\documentclass[twoside,11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{listings}
\usepackage{xcolor, color}
\usepackage{graphics, graphicx, rotating}
\usepackage{float}
\usepackage[caption=false]{subfig}
\usepackage{algpseudocode, algorithm}
\usepackage{url, hyperref}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
Then, at the end of the file, I have
\bibliographystyle{plain}
\bibliography{bib}
In the .bib file I have
#phdthesis{kon,
author = {K\"{o}n},
title = {TITLE}
year = {2014}
}
However, when I compile (I'm using TeXStudio), I get what you see in the image.
It doesn't seem to be recognizing that there are two quotes (' is highlighted in blue and then ' is highlighted in black in the IDE I'm using). I'm not sure how to get the correct accent mark. I can't seem to find this issue elsewhere, and there are no other ways in latex literature (that I can find). Thank you!
Code for .tex file:
\documentclass[twoside,11pt]{article}
\usepackage{jmlr2e}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{listings}
\usepackage{xcolor, color}
\usepackage{graphics, graphicx, rotating}
\usepackage{float}
\usepackage[caption=false]{subfig}
\usepackage{algpseudocode, algorithm}
\usepackage{url, hyperref}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
Here is how it gets cited: \citep{konig2014}
\bibliographystyle{plain}
\bibliography{bibl}
\end{document}
Code for .bib file:
#phdthesis{konig2014,
author = {K\''{o}nig, R.},
title = {Enhancing genetic programming for predictive modeling},
school = {\''{O}rebro University},
year = {2014}
}
Since your edit, your .bib file shows \'' (backslash, single quote, single quote), which is wrong and results in the weird accents you're seeing: it's putting an acute accent (´, coded as \') on top of a single quote (', also coded as '). The correct syntax is \" (backslash, double quote).
If I write the .bib file in the program TeXworks, then \" (backslash, double quotes) automatically turns into \'' (backslash, single quote, single quote). Even if I compile my .tex file that references the .bib file in TeXstudio, I still get weird symbols as show in the image above, rather than the expected two dots above the o because TeXworks doesn't seem to recognize the double quotes. BUT if I write the .bib file in the TeXstudio program, then it compiles as expected. I'm not sure what's going on behind the scenes (maybe there is a setting I have to change?), but the issue was TeXworks, not the \"{o}.
Thanks all for your help!
Related
[EDIT]
I am having issues changing the citation style to my document. I am currently working with this preamble. There are a lot of packages, but I need them to organise the entire file. The current code works ok, but the citation style is not correct. I need to change it to apa 6th edition.
Preamble:
\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{helvet}
\usepackage{xspace}
\usepackage{subcaption}
\usepackage{placeins}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{adjustbox}
\usepackage{booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage{ragged2e}
\usepackage{floatrow}
\usepackage{graphicx,wrapfig,lipsum}
\graphicspath{{../figs/}}
\usepackage{pdfcomment}
\usepackage{geometry}
\newgeometry{left=2.5cm,right=2.5cm,bottom=2.5cm}
\usepackage[english]{babel}
\usepackage{CJKutf8}
\pagestyle{headings}
\usepackage{blindtext}
\usepackage{csquotes}
\setcounter{secnumdepth}{4}
\usepackage{titlesec}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex[columns=3, title=Alphabetical Index]
\usepackage{array}
\usepackage{tikzpagenodes}
\usepackage[format=plain, labelfont={bf,it}, textfont=it]{caption}
\usepackage{fancyhdr}
\usepackage[toc,nopostdot, nonumberlist,style=long,automake,acronym]{glossaries}
\usepackage{subfiles}
\usepackage{nicematrix}
\usepackage{amsmath,mathabx}
\usepackage{hyperref}
\usepackage{lscape}
\newcommand{\sectionbreak}{\phantomsection}
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=black,
urlcolor=black,
citecolor=olive,
pdftitle={PhD Dissertation},
pdfpagemode=FullScreen,
}
\urlstyle{same}
%\bibliographystyle{abbrvnat}
%\usepackage[authoryear]{natbib}%/bibliography apa
%\setcitestyle{authoryear,open={(},close={)}} %Citation-related commands
The bibliography file called bib.bib
Example:
#article{henriquez_alternative_2017,
title = {An alternative objective microscopic method for the identification of linear enamel hypoplasia ({LEH}) in the absence of visible perikymata},
volume = {14},
doi = {10.1016/j.jasrep.2017.05.040},
journal = {Journal of Archaeological Science: Reports},
author = {Henriquez, Alejandra Cares and Oxenham, Marc F.},
year = {2017},
pages = {76--84},
file = {Full Text:C\:\\Users\\xello\\Zotero\\storage\\MV7QMSWQ\\Henriquez and Oxenham - 2017 - An alternative objective microscopic method for th.pdf:application/pdf},
}
Example of text citing something
\begin{document}
\begin{CJK*}{UTF8}{min}
\citep{henriquez_alternative_2017}, \citet{henriquez_alternative_2017}.
\end{CJK*}
\end{document}
I need to change the citation style to apa6: https://www.ctan.org/pkg/apa6. When Io tried to add this package. It entered into conflict with other packages like titlesec and amsmath, mathabx.
I get errors like
...ex/titlesec/titlesec.sty, 1642. Argument of \subparagraph has an
extra }. or Runaway argument?
or
eric/mathabx/mathabx.sty, 67. Latex Error: Too many symbol fonts
declared.
respectively.
I am not sure how to add this citation style to my current project. Maybe there is an alternative way? I need the packages I am using (like titlesec) to order my document.
Any help will be welcomed.
Thank you,
[EDIT] Solved it. I used Biblatex (https://ctan.org/pkg/biblatex-apa6?lang=en) which also has an apa6 option. Solved additional errors. Works well.
I'm a Technical Writer trying to output a Python-Sphinx website into a .pdf via LaTeX. The manual has a safety regulations and environmental compliance section with about 40+ languages in it. These languages all appear as-is in the base file - and .rst files have the same unicode support as .txt, so if Bulgarian renders appropriately in Cyrillic in the base file I'm assuming it's encoded correctly.
I already know to use either LuaLaTeX or XeLaTeX to render unicode properly, and I've already found that TeX files compiled from Sphinx/.rst render better under LuaLaTeX. Even so, under LuaLaTeX, the Greek and Cyrillic don't render at all (nor do accented letters, but for some reason Germanic eth/ð does render).
Everything I've seen on multi-language support involves one of several packages that require you to bracket each section with something like \begin{Russian}, but for all 40+ languages. With the base file being in a different format and the .tex file being generated automatically, every time I update the manual it would save over all the work I've done.
The best solution for me would be to put all the multi-language support in the header, and just say "hey dumb dumb... just render the unicode text as-is". As it is, the auto-generated frontspiece and ToC is unsatisfactory, so I'm keeping the header saved in a separate document and I'm pasting the better header in. Front-loading multi-language support by defining everything in the header is definitely the most ideal solution.
Any help would be good.
The following is the header provided by Python-Sphinx, with minor adjustments:
%% Generated by Sphinx.
\def\sphinxdocclass{report}
\documentclass[letterpaper,10pt,english]{sphinxmanual}
\ifdefined\pdfpxdimen
\let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
\fi \sphinxpxdimen=.75bp\relax
\ifdefined\pdfimageresolution
\pdfimageresolution= \numexpr \dimexpr1in\relax/\sphinxpxdimen\relax
\fi
%% let collapsible pdf bookmarks panel have high depth per default
\PassOptionsToPackage{bookmarksdepth=5}{hyperref}
\PassOptionsToPackage{warn}{textcomp}
\usepackage[utf8]{inputenc}
\ifdefined\DeclareUnicodeCharacter
% support both utf8 and utf8x syntaxes
\ifdefined\DeclareUnicodeCharacterAsOptional
\def\sphinxDUC#1{\DeclareUnicodeCharacter{"#1}}
\else
\let\sphinxDUC\DeclareUnicodeCharacter
\fi
\sphinxDUC{00A0}{\nobreakspace}
\sphinxDUC{2500}{\sphinxunichar{2500}}
\sphinxDUC{2502}{\sphinxunichar{2502}}
\sphinxDUC{2514}{\sphinxunichar{2514}}
\sphinxDUC{251C}{\sphinxunichar{251C}}
\sphinxDUC{2572}{\textbackslash}
\fi
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amstext}
\usepackage{babel}
\usepackage{tgtermes}
\usepackage{tgheros}
\renewcommand{\ttdefault}{txtt}
\usepackage[Bjarne]{fncychap}
\usepackage{sphinx}
\fvset{fontsize=auto}
\usepackage{geometry}
% Include hyperref last.
\usepackage{hyperref}
% Fix anchor placement for figures with captions.
\usepackage{hypcap}% it must be loaded after hyperref.
% Set up styles of URL: it should be placed after hyperref.
\urlstyle{same}
\usepackage{sphinxmessages}
\title{...}
\date{\today}
\release{...}
\author{...}
\makeindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
The document is almost entirely in English except for one dang section near but not at the end:
- Това е българско
- Αυτό είναι ελληνικό
- Tohle je česky
- Bu türkçe
- Þetta er íslenskt
\end{document}
Caveat: This won't give correct hyphenation and other special language settings (e.g. French spacing for punctuation marks), but it will show the text. If you want these other features as well, you will have to deal with babel or polyglossia.
The unicode capabilities of xe- and lualatex only fully unfold if you also use a font which does have a good coverage of symbols.
For example with the Noto Serif font:
% !TeX TS-program = lualatex
%% Generated by Sphinx.
\def\sphinxdocclass{report}
\documentclass[letterpaper,10pt,english]{sphinxmanual}
\ifdefined\pdfpxdimen
\let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
\fi \sphinxpxdimen=.75bp\relax
\ifdefined\pdfimageresolution
\pdfimageresolution= \numexpr \dimexpr1in\relax/\sphinxpxdimen\relax
\fi
%% let collapsible pdf bookmarks panel have high depth per default
\PassOptionsToPackage{bookmarksdepth=5}{hyperref}
\PassOptionsToPackage{warn}{textcomp}
\usepackage[utf8]{inputenc}
\ifdefined\DeclareUnicodeCharacter
% support both utf8 and utf8x syntaxes
\ifdefined\DeclareUnicodeCharacterAsOptional
\def\sphinxDUC#1{\DeclareUnicodeCharacter{"#1}}
\else
\let\sphinxDUC\DeclareUnicodeCharacter
\fi
\sphinxDUC{00A0}{\nobreakspace}
\sphinxDUC{2500}{\sphinxunichar{2500}}
\sphinxDUC{2502}{\sphinxunichar{2502}}
\sphinxDUC{2514}{\sphinxunichar{2514}}
\sphinxDUC{251C}{\sphinxunichar{251C}}
\sphinxDUC{2572}{\textbackslash}
\fi
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amstext}
\usepackage{babel}
\usepackage{tgtermes}
\usepackage{tgheros}
\renewcommand{\ttdefault}{txtt}
\usepackage[Bjarne]{fncychap}
\usepackage{sphinx}
\fvset{fontsize=auto}
\usepackage{geometry}
% Include hyperref last.
\usepackage{hyperref}
% Fix anchor placement for figures with captions.
\usepackage{hypcap}% it must be loaded after hyperref.
% Set up styles of URL: it should be placed after hyperref.
\urlstyle{same}
\usepackage{sphinxmessages}
\title{...}
\date{\today}
\release{...}
\author{...}
\makeindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fontspec}
\setmainfont{Noto Serif}
\begin{document}
The document is almost entirely in English except for one dang section near but not at the end:
- Това е българско
- Αυτό είναι ελληνικό
- Tohle je česky
- Bu türkçe
- Þetta er íslenskt
\end{document}
(to see which fonts on your computer support the characters you want to use, you can use the command line tool albatross, see e.g. https://stackoverflow.com/a/69721465/2777074)
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.
I am using the code shown below, to generate the numeric references in IEEE style, but instead of numbers, it gives the output in alphabetic names. Also it is not printing the references list.
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[nottoc]{tocbibind}
using the below package for referencing
\usepackage{biblatex}
Below is my .bib file
\addbibresource{References.bib}
\input{Chapters/Literature}
\printbibliography
\documentclass{book}
\usepackage{amsmath}
\usepackage[german]{babel}
\usepackage{amssymb}
\usepackage{amsxtra}
\usepackage[dvips]{epsfig,psfrag}
\usepackage{listings}
\newcommand{\refchapter}[1]{Kapitel~\ref{#1}}
\newcommand{\refsec}[1]{Sektion~\ref{#1}}
\newcommand{\refeqn}[1]{Gleichung~(\ref{#1})}
\newcommand{\reffig}[1]{Abbildung~\ref{#1}}
\title{\bf Grundz\"uge der Softwareentwicklung \\
{\small Analyse- und Entwurfsdokument} \vspace{1cm}\\
\centering
\epsfig{file=figures/logo.eps,width=.4\textwidth}
}
\author{Uschi Musterfrau, Detlef Mustermann und Ralf Auchmustermann}
\date{Matr.-Nr. 0815, 0816 und 0817 \\
email: {\tt [uschi|detlef|ralf]#rwth-aachen.de}
}
\begin{document}
\lstloadlanguages{[ISO]C++}
\lstset{basicstyle=\small, numbers=left, numberstyle=\footnotesize,
stepnumber=1, numbersep=5pt, breaklines=true, escapeinside={/*#}{#*/}}
\pagestyle{headings}
\maketitle
\tableofcontents
\include{vorwort}
\include{analyse}
\include{entwurf}
\include{nutzerdoc}
\include{entwicklerdoc}
\bibliographystyle{plain}
\bibliography{analyse_entwurf}
\appendix
\include{quellcode}
\end{document}
this is how my file starts. I didn't even edit it, I received it like this. However, if I want to make a pdf, it gives me the undefined control sequence error at the first line... What is wrong??
My guess is that you're trying to use TeX instead of LaTeX. TeX won't recognize the \documentclass command. Make sure you use LaTeX.
It might be that one of the tools in your tool chain gets irritated by a Byte-Order Mark (BOM), which is a special Unicode character to indicate the endianness used in your file.
Unfortunately, a BOM may have unwanted side-effects.
You might try to save the file with another editor which won't add this mark in the beginning, or remove it with a hex editor.
try getting rid of \usepackage[dvips]{epsfig,psfrag} if you're using pdflatex.
Perhaps TeXshop doesn't recognize your file as a LaTeX file and runs it with plain TeX or ConTeXt. If you can post your logfile (the beginning) here, we can help you for sure.