Quantcast
Viewing all articles
Browse latest Browse all 3

Why does foreign language text not hyphenate even when using Babel? Typst hyphenates it correctly

Why do I not get the same hyphenation results as Typst when using babel in LuaLaTeX? I have tried various methods for fixing the issue, but they dont work.

Both use Letterpaper sized paper, use custom top, bottom, left and right 1.5cm margins, 12pt font size, and are using the STIX Two Text Font.

  • LuaLaTeX Code:
% {\documentclass[letterpaper,12pt]{article}\usepackage[left=1.5cm, right=1.5cm, top=1.5cm, bottom=1.5cm]{geometry}\usepackage{indentfirst}\usepackage{fancyhdr}\usepackage{csquotes}\usepackage{microtype}\usepackage{unicode-math} % loads fontspec    \setmainfont{STIX Two Text}[Ligatures=TeX]    \setmathfont{STIX Two Math}\usepackage[main=english,spanish,russian]{babel} \makeatletter\renewcommand{\@maketitle}{%\newpage\null\vspace{-0.125cm} % This corresponds to the top margin set by geometry\begin{center}\parskip=0pt\let\footnote\thanks {\LARGE \@title \par }%{\large \lineskip .5em%\begin{tabular}[t]{c}%\@author\end{tabular}%\par }%\vspace{.25cm} % Adjust this value to control the space between the author and date{\large \@date }%\end{center}\par \vspace{.25cm} % This corresponds to the bottom margin set by geometry}\makeatother \setlength\parindent{.25cm} % }\title{Title}\author{Author}\date{\today}\begin{document}\noindent\begin{minipage}{\textwidth}\maketitle\end{minipage}\selectlanguage{russian}Каклучшевсегополучитьто, чтотыхочешь? - спросилаона. Онпосмотрелвземлю, зная, чтоейнепонравитсяегоответ. Онколебался, зная, чтоправдатолькоповредит. Каконсобиралсясказатьейэто? лучшийспособполучитьто, чтоонхотел, этооставитьее. ЗавтраявозвращаюсьвКолорадопослетого, какнавыходныхпровелтамфестивальвСанта-Барбаре. Тамябудустроитьпланынаоктябрьипостараюсьдоговориться, чтобы, есливозможно, вернутьсясюданаденьрождения. Ясообщувам, кактолькоузнаюграфикприемаврачаипланыполетов. Стулстоялвуглу, гдепростоялболее 25 лет. Единственнаяразницазаключаласьвтом, чтовнемдействительнокто-тосидел. Скольковременипрошлостехпор, каккто-тоэтоделал? Поегомнению, десятьлетилибольше. Ивсеженельзябылоотрицатьприсутствиевкреслесейчас.\end{document}

Here is the Typst code,

  • Template Code:
// The project function defines how your document looks.// It takes your content and some metadata and formats it.// Go ahead and customize it to your liking!#let project(title: "", authors: (), date: none, body) = {  // Set the document's basic properties.  set document(author: authors, title: title)  set page(    paper: "us-letter",    margin: (left: 15mm, right: 15mm, top: 15mm, bottom: 15mm),    numbering: "1",    number-align: center,  )  set text(font: "STIX Two Text", lang: "en", 12pt)  // Set paragraph spacing.  show par: set block(above: 0.75em, below: 0.75em)  set heading(numbering: "1.1.")  set par(leading: 0.58em)  // Title row.  align(center)[    #block(text(weight: 700, 1.75em, title))    #v(0.8em, weak: true)    #date  ]  // Author information.  pad(    top: 0.3em,    bottom: 0.3em,    x: 2em,    grid(      columns: (1fr,) * calc.min(3, authors.len()),      gutter: 1em,      ..authors.map(author => align(center, strong(author))),    ),  )  // Main body.  set par(justify: true)  body}
  • Document Code:
#import "template.typ": *// Take a look at the file `template.typ` in the file panel// to customize this template and discover how it works.#show: project.with(  title: "Template",  authors: ("Author",  ),  date: "January 6, 2024",)#h(.25cm) #set text(lang: "ru"); Каклучшевсегополучитьто, чтотыхочешь? - спросилаона. Онпосмотрелвземлю, зная, чтоейнепонравитсяегоответ. Онколебался, зная, чтоправдатолькоповредит. Каконсобиралсясказатьейэто? лучшийспособполучитьто, чтоонхотел, этооставитьее. ЗавтраявозвращаюсьвКолорадопослетого, какнавыходныхпровелтамфестивальвСанта-Барбаре. Тамябудустроитьпланынаоктябрьипостараюсьдоговориться, чтобы, есливозможно, вернутьсясюданаденьрождения. Ясообщувам, кактолькоузнаюграфикприемаврачаипланыполетов. Стулстоялвуглу, гдепростоялболее 25 лет. Единственнаяразницазаключаласьвтом, чтовнемдействительнокто-тосидел. Скольковременипрошлостехпор, каккто-тоэтоделал? Поегомнению, десятьлетилибольше. Ивсеженельзябылоотрицатьприсутствиевкреслесейчас.

Viewing all articles
Browse latest Browse all 3

Trending Articles