Quantcast
Channel: Question and Answer » babel
Viewing all 75 articles
Browse latest View live

Does pdfTex produce warnings when it doesn't find the word hyphenation pattern?

$
0
0

In my document I use babel package and load several languages for correct hyphenation.

usepackage[icelandic, latin, czech]{babel}

I add manually words that babel package doesn’t know.

begin{hyphenrules}{icelandic}
hyphenation{
  pla-tó-nskt
}
end{hyphenrules}

I wonder if I can find in log file warnings when the pdfTex using babel package tries to hyphenate word that it actually does not know. That would help me in adding the words into hyphenate rules.


Problem with natbib and french babel after migrating to El Capitan

$
0
0

After migrating to Mac OS 10.11 (El Capitan), I have a problem using citations in my document. I have the following warning:

No errors. Warnings:

./Thesis_LP.tex:100: Package frenchb.ldf Warning: Please load the "natbib" package(frenchb.ldf) BEFORE babel/frenchb; reported on input line 100.

However I have made no change between the .tex versions, and under Yosemite all worked fine. Searched in forums without success. Any idea?

tracking of fonts in small capital with frenchb from babel+ microtype

$
0
0

I have a problem in enabling tracking of small caps [whether the font has small caps or not] when I load french babel plus microtype.
The problem appears only in my titles for the section and only when those titles have some characters !, » and perhaps others.
If I disable the tracking from microtype, all goes well.

LuaTeX error /texmf-dist/tex/generic/babel-french/frenchb.lua:66: attempt to index a nil value. section{SSS! » !}

Here is a extract from the manual of frenchb, at page 38, which says that babels tweaks the small caps :

bsc: As family names
should be written in small capitals and never be hyphenated, we
provide a command (its name comes from Boxed Small Caps) to input them
easily. Note that this command has changed with version 2 of frenchb:
a kern0pt is used instead of hbox because hbox would break
microtype’s font expansion; as a (positive?) side effect, composed
names (such as Dupont-Durand) can now be hyphenated on explicit
hyphens. Usage: Jean~bsc{Duchemin}.

DeclareRobustCommand*{bsc}[1]{leavevmodebegingroupkern0pt scshape #1endgroup}
ifLaTeXeelseletscshaperelaxfi

I have no error when lualatex compiles with microtype without babel and I do not have errors when only babel is present.
There is no error with microtype+babel **if I do not redefine my section with scshape.**

I need polyglossia because I have other languages with peculiar fonts,. I have no error when I disable tracking in microtype, but still keep babel+polyglossia+microtype… plus my definition of section

This is the tex file

documentclass[oneside,a4paper, 12pt]{article}

usepackage[frenchb]{babel}%%


usepackage{fontspec}
defaultfontfeatures{
Ligatures=TeX,
%Mapping=tex-text,
SmallCapsFeatures={Renderer=Basic}
}
setmainfont{TeX Gyre Termes}

usepackage{polyglossia}
setmainlanguage{french}



makeatletter
renewcommandsection{%
penalty-9999
@startsection {section}{1}{0em}{0parskip}{1cm}{%
centeringrmfamilybfseriesscshape%
righthyphenmin=62%
}
}
makeatother


usepackage[%
babel=true,
%protrusion=true,
%expansion=true,
%%%%%activate={true,nocompatibility}
%kerning=false,
%spacing=false,
tracking=true,
%factor=1100,
%stretch=40,
%shrink=10
]{microtype}
SetTracking{encoding={*}, family= *, shape=sc}{33}

begin{document}

section{SSS! » !}



end{document}

Babel french doesn't work with smfart class

$
0
0

If I compile the minimal exemple

documentclass[francais]{smfart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{lmodern}
usepackage[french]{babel}
begin{document}
test:test; test! og fg test
end{document}

I don’t get the right french’s spacing for “:”, “;” and “!” and the angle quotes signs ” instead of the french’s ones « and » .

Does anyone know what is the problem?

(The smfart class is available here.)

babel and index both redefine markboth and markright

$
0
0

I use both the index and babel packages. They both redefine markboth and markright. If I include babel before index, the index package warns me about the double redefinition. Code:

documentclass{article}
usepackage[english]{babel}
usepackage{index}
begin{document}
end{document}

Extract from the TeX output:

(/usr/share/texlive/texmf-dist/tex/latex/index/index.sty

LaTeX Warning: Command markboth  has changed.
               Check if current package is valid.


LaTeX Warning: Command markright  has changed.
               Check if current package is valid.

) (./a.aux) (./a.aux) )

If I swap the two usepackage lines so that index is loaded before babel, there’s no warning. But either way I’m getting the definition of these commands from whichever is loaded last.

My objective is twofold: I want to get rid of the warning (because nonactionable warnings drown out the actionable ones), and I want to understand what I’m losing either way (I haven’t spotted any problem so far, but I could be missing something, or run into unexpected problems later as I write more of the document). Presumably, if both packages redefine these commands, they have a good reason.

Should I include babel before or after index? If before, how do I get rid of the warning?

Is there anything I can/should do to make sure that both babel and index are working correctly? What problems should I be looking for?

I can't use an accent into a file directory with hyperref

$
0
0

suppose i have this path C:holá where holá is a folder.
I need to open it. So I tried with href{run:C:/holá}{folder with an accent}. But this error message appears: “C:holunhbox…”
What can I do?

(this is my first question & i am not a English speaker).

How to get babel's language shorthands work inside biblatex entries with autolang=hyphen and langid fields?

$
0
0

I’m writing a German document, where I frequently cite works in English and other languages. Used to babel’s shorthands in ngerman for easily modifying hyphenation symbols in compound words or names (for example "= for an additional hyphen that should always be printed, and "" for a possible line break without a hyphen), I also activated those shorthands for english using the addtoextrasenglish commands.

Inside otherlanguage environments in the main document’s text, everything works as expected.

biblatex, which I use for managing my bibliographies, offers the autolang option and the langid field for switching hyphenation rules for each bibliographic entry. When I set autolang to other, it puts an otherlanguage environment around the citations and bibliography entries, and therefore uses the shorthands. But it then also prints terms like and in English, which is not desireable in an overall German document. biblatex therefore offers the autolang=hyphen option to only activate the hyphenation rules for the language specified in the langid field, while falling back to the main document language for all other terms.

However, then the shorthands do not work anymore. How do I get them to work?

Here’s an MWE:

documentclass{scrartcl}

usepackage{fontspec}
usepackage[english,ngerman]{babel}
addtoextrasenglish{useshorthands{"}languageshorthands{ngerman}}
usepackage{csquotes}
usepackage[backend=biber,autolang=hyphen,style=verbose]{biblatex}

usepackage{filecontents}
begin{filecontents}{bibliography.bib}
@collection{NMR,
  editor = {Wardrip"=Fruin, Noah and Montfort, Nick},
  title = {The New Media Reader},
  location = {Cambridge/""MA and London},
  publisher = {MIT Press},
  year = 2003,
  langid = {english}
}
end{filecontents}

addbibresource{bibliography.bib}

begin{document}

begin{otherlanguage}{english}
  Manually using babel shorthands inside an texttt{otherlanguage}
  environment, everything works as expected: Wardrip"=Fruin.
  Cambridge/""MA.
end{otherlanguage}

Yet, citing the work from the bibliography, where it was given a
texttt{langid} field, the shorthands do not work.autocite{NMR}

Neither do they work in the bibliography:
printbibliography
end{document}

How to get babel's language shorthands work inside biblatex entries with autolang=hyphen and langid fields?

$
0
0

I’m writing a German document, where I frequently cite works in English and other languages. Used to babel’s shorthands in ngerman for easily modifying hyphenation symbols in compound words or names (for example "= for an additional hyphen that should always be printed, and "" for a possible line break without a hyphen), I also activated those shorthands for english using the addtoextrasenglish commands.

Inside otherlanguage environments in the main document’s text, everything works as expected.

biblatex, which I use for managing my bibliographies, offers the autolang option and the langid field for switching hyphenation rules for each bibliographic entry. When I set autolang to other, it puts an otherlanguage environment around the citations and bibliography entries, and therefore uses the shorthands. But it then also prints terms like and in English, which is not desireable in an overall German document. biblatex therefore offers the autolang=hyphen option to only activate the hyphenation rules for the language specified in the langid field, while falling back to the main document language for all other terms.

However, then the shorthands do not work anymore. How do I get them to work?

Here’s an MWE:

documentclass{scrartcl}

usepackage{fontspec}
usepackage[english,ngerman]{babel}
addtoextrasenglish{useshorthands{"}languageshorthands{ngerman}}
usepackage{csquotes}
usepackage[backend=biber,autolang=hyphen,style=verbose]{biblatex}

usepackage{filecontents}
begin{filecontents}{bibliography.bib}
@collection{NMR,
  editor = {Wardrip"=Fruin, Noah and Montfort, Nick},
  title = {The New Media Reader},
  location = {Cambridge/""MA and London},
  publisher = {MIT Press},
  year = 2003,
  langid = {english}
}
end{filecontents}

addbibresource{bibliography.bib}

begin{document}

begin{otherlanguage}{english}
  Manually using babel shorthands inside an texttt{otherlanguage}
  environment, everything works as expected: Wardrip"=Fruin.
  Cambridge/""MA.
end{otherlanguage}

Yet, citing the work from the bibliography, where it was given a
texttt{langid} field, the shorthands do not work.autocite{NMR}

Neither do they work in the bibliography:
printbibliography
end{document}

No autorefname for appendices when using babel with ngerman and appendix package

$
0
0

When using the appendix package together with [ngerman]{babel} changing appendixautorefname or Appendixautorefname has no effect.

The error message No autoref name for 'Anhang' [...] persists.

How do I get this to work?

Thanks a lot in advance.

MWE:

documentclass{book}
usepackage[titletoc]{appendix}
usepackage[ngerman]{babel}
addtoextrasngerman{%
    defchapterautorefname{Kapitel}%
    defappendixautorefname{Anhang}%
    defAppendixautorefname{Anhang}%
}
usepackage{hyperref}

begin{document}
chapter{a}label{ch:a}
Reference to chapter: autoref{ch:a}

Reference to appendix: autoref{App}

begin{appendices}
chapter{Ein Anhang}label{App}
end{appendices}

end{document}

enter image description here

PS: I already asked this question(s) in the comment section of No autoref name for `Appendix' but felt better opening a new Question for this.

Enable extra hyphenation points for compound words that already contain a hyphen character?

$
0
0

Friends :) , I would like to have compound words that contain hyphen characters, such as “Baden-Württemberg”, to be permitted to be hyphenated at all points in the component words as well (here: “Ba-den” and “Würt-tem-berg”).

I know of the discussions that this might look ugly, and I know that I could write something like Ba-den-Würt-tem-berg. But I am providing a package for customer use, and it is hard to make everyone insert escape characters or manual hyphenation instructions on thousands (!) of pages of manuscript. Separation of form and content is, after all, one of the strong features of LaTeX.

So, is there an easy switch to disable the hyphenation prevention for words containing a hyphen? I have only access to the preamble of the document, so I cannot insert anything in the text.

I am using LuaLaTeX and fontspec, so hacking the hyphenchar like in this post doesn’t work.
Neither is it an option for me to insert hyphenation{Ba-den=Würt-tem-berg} into the preamble for each word as was suggested in this post. I have to provide a package for general use.

I don’t know if this question might be a duplicate.

Here is a MWE to play around with:

documentclass{article}
usepackage{fontspec}

setmainfont{Latin Modern Roman}[HyphenChar="2010] 
%setmainfont{Linux Libertine O}[HyphenChar="2010] %does not work
usepackage[english]{babel}
usepackage{lipsum}

begin{document}

lipsum[1]
Test electromagnetic-endioscopy
electromagnetic-endioscopy
electromagnetic-endioscopy
electromagnetic-endioscopy
Test electromagnetic-endioscopy
electromagnetic-endioscopy
electromagnetic-endioscopy
electromagnetic-endioscopy
electromagnetic-endioscopy
electromagnetic-endioscopy

end{document}

Note that the HyphenChar="2010 works only for Latin Modern and it prevents hyphenation at the hyphen. That makes it come close to the desired result but hyphenation at the hyphen if possible would be desirable.

Failing to translate the Number of the chapter with Babel [on hold]

$
0
0

I’m using sphinx and latex to generate my documentation.

I need to translate the document in another language and I use tha package babel (added to the conf.py file).

While babel translates correctly some parts of the documents (e.x. en Chapter -> it Capitolo) the numbers of the chapter are still in English.

Here a screenshot:

enter image description here

how can I also translate the number from one to uno?

Another possible solution will be to convert strings to numbers (one to 1).

Anybody has an idea?

EDIT

Here the piece of code of the conf.py where the custom file sheet is read::

# -- Options for LaTeX output ---------------------------------------------
f = open('custom_style.sty', 'r+');
PREAMBLE = f.read();

latex_elements = {
    'babel':'\usepackage[english,italian]{babel}',
    'maketitle': '',  # No Title Page
    #'papersize':'a4paper'
    #'pointsize':'10pt',
    'preamble' : PREAMBLE
}

and I found a way to transform ONE into 1, but it looks like a workaround and I was wondering if the is not a straightforward way to do that.

Here the piece of code of the custom-style.sty where I specified the chapter header:

% Define new color (same of the default of section)
definecolor{MSBlue}{RGB}{32, 67, 92}

usepackage[tracking=smallcaps]{microtype}

titleformat{chapter}[display]
  % uncomment the following line to have the chapter title of another color
  %{normalfontLarge color{MSBlue}}
  {normalfontLargebfseries}
  {fillefttextls{MakeUppercase{chaptertitlename}} Largethechapter}
  {1ex}
  {titlerulevspace{1ex}filleft}

that brings to the following header:

enter image description here

Thanks

Conflict between standard BibLatex and Babel [on hold]

$
0
0

The following minimalistic document produces an “Undefined control sequence” error at begin{document}. When I put usepackage[english]{babel}in comments the error disappears. The compilation steps I am doing are pdflatex -> biber -> pdflatex.

documentclass[a4paper, 12pt]{report}

usepackage[backend=biber,style=alphabetic,citestyle=authoryear]{biblatex}
usepackage[english]{babel}

begin{document}
hello world
end{document}

For obvious reasons I really want references in my document, but I would also like to use babel. I am using MiKTeX 2.9, pdfTeX version 3.1415926-2.5-1.40.14. Biblatex version is 3.3, and babel is 3.8m. Is there any solution to this conflict of packages?

BibLat

Fail to redefine enumerate when babel used

$
0
0

I wish to redefine the enumerate environment to have a continuous numbering through the different lists. I managed to do this, but my solution fails when using the babel package. Here is my ECM: it’s OK when the babel line is commented.

May anyone explain me what’s wrong with this package? Thanks a lot.

documentclass{article}

usepackage[T1]{fontenc}
usepackage[frenchb]{babel}

defnbq{0}
letoldenumerateenumerate
letoldendenumerateendenumerate
renewenvironment{enumerate}{oldenumeratesetcounter{enumi}{nbq}}{xdefnbq{theenumi}oldendenumerate}

begin{document}

begin{enumerate}
item nbq
item nbq
end{enumerate}

begin{enumerate}
item nbq
item nbq
end{enumerate}

end{document}

Problem with Spanish Babel

$
0
0

I have a problem with Spanish babel. I use PCTeX V6.1 and Windows 10 Pro.

usepackage[spanish,es-lcroman,es-uppernames]{babel}
decimalcomma
unaccentedoperators

but I get the following errors:

(d:/Program Files (x86)/PCTeX/PCTeXv6/texmf-dist/tex/latex/base/size10.clo))
(d:/Program Files (x86)/PCTeX/PCTeXv6/texmf-dist/tex/generic/babel/babel.sty
(d:/Program Files (x86)/PCTeX/PCTeXv6/texmf-dist/tex/generic/babel/spanish.ldf
(d:/Program Files (x86)/PCTeX/PCTeXv6/texmf-dist/tex/generic/babel/babel.def))
! Package babel Error: Language definition file es-lcroman.ldf not found.

In top of the above, now I have no spell checker working for the Spanish Language.

What can I do?

Problem using autostyle from csquote with multi languages macros

$
0
0

I get some macros to enable me to generate a document in three different languages from the same .txt file (for example a CV). But the format of the quote is dependent of the order in which I load the languages with babel instead of the selected languages.
For example in the MWE the selected language is English, but the quotation format is French since this is the last loaded language in babel.

documentclass[]{article}
usepackage[UKenglish,german,french]{babel}
usepackage[autostyle=true]{csquotes}
% define the commands to switch and the flags in LaTeX
newcommand{GERMAN}{germantrue frenchfalse englishfalse
                     selectlanguage{german}}
newcommand{FRENCH}{germanfalse  frenchtrue englishfalse
                     selectlanguage{french}}
newcommand{ENGLISH}{germanfalse  frenchfalse englishtrue
                      selectlanguage{UKenglish}}
newififgerman germantrue
newififfrench frenchtrue
newififenglish englishtrue

% then choose one language to be displayed
%GERMAN
%FRENCH
ENGLISH
    newcommandhide[1] {}
    newcommandgerman[1] {ifgerman #1 else fi}
    newcommandfrench[1] {iffrench #1 else fi}
    newcommandenglish[1] {ifenglish #1 else fi}
    begin{document}
    german{enquote{Etwas}}french{enquote{Quelque chose}}english{enquote{something}}
end{document}

So the result is ≪ something ≫ intead of `something’

How should I change the code to make that the autostyle consider the selected language ?


Viewing all 75 articles
Browse latest View live