definability / latex-dstu

DSTU LaTeX template with Dockerfile
MIT License
12 stars 2 forks source link

Latin "i" is being substituted for Ukrainian "і" on compilation #3

Open curldivergence opened 2 years ago

curldivergence commented 2 years ago

Hi, the problem is pretty much self-explanatory :) Some googling shows it's a known issue and the only real fix is to move to XeLaTeX.

I can guess you have no interest in migrating this setup to XeLaTex, so probably you could put a big red warning in the repo's readme so that people are aware of the problem in advance? It can look pretty bad in a plagiarism check report :)

Thanks!

definability commented 2 years ago

Thanks, @curldivergence, yes, I have already edited the template locally for XeLaTeX several months ago but I am lazy to push it here :sweat_smile: Not because there are a lot of changes but because I want to make it prettier. First of all, I have to remove all redundant packages from usepackage and all my old macros left from my bachelor's thesis. Next, I want to update the instruction: it's stupid to build all this with root and then have those issues with sudo rm. I also found out how to specify the output directory to not have all this garbage with out and log everywhere. And last but not least is a correct synctex.gz with correct folders, allowing you to jump to your code from PDF viewer and back again (Overleaf and TeXStudio have such functionality). Also, I would like to update TeXLive and Linux versions for this image because it looks ve~ry old now. Though, I'm planning to push these changes — maybe in another repository or in this one under another tag. I'm working on my PhD thesis now, so be sure that I will do this somewhere in the future and will not forget this repository :slightly_smiling_face:

Yes, the issue here is about a plagiarism check report and also this makes search more inconvenient.

Thank you for your attention to this work, I'll try to speed up myself with this!

The build script xelatex-build-bib.sh should look like this

#!/bin/sh

FILENAME="${1:-index}"
xelatex ${FILENAME}.tex && bibtex ${FILENAME} && \
xelatex ${FILENAME}.tex && pdflatex ${FILENAME}.tex

The package babel should be removed from head_ua.tex

--- head_ua.tex 2019-08-15 21:24:53.000000000 +0300
+++ head_ua.tex    2021-04-30 22:24:38.076240278 +0300
@@ -1,5 +1,5 @@
-\documentclass[a4paper,14pt,russian]{extreport}
-\usepackage[ukrainian]{babel}
+\documentclass[a4paper,14pt]{extreport}

 \def\TableCaption{Таблиця}
 \def\FigureCaption{Рисунок}

Also, edit the style file. You don't need pscyr and T2A anymore

--- dsturep_ua.sty      2019-08-15 21:24:53.000000000 +0300
+++ dsturep_ua.sty     2021-05-10 20:03:18.695109263 +0300
@@ -1,12 +1,10 @@
 \ProvidesPackage{dsturep}
 \usepackage{cmap}
-\usepackage[T2A]{fontenc}
-\usepackage[utf8]{inputenc}

-\usepackage{pscyr}
-\renewcommand{\rmdefault}{ftm}
+\usepackage{xecyr}
+\usepackage[english,russian,ukrainian]{babel} 
+\usepackage{fontspec} 
+\setmainfont{Times New Roman}

If you don't have Times New Roman, use \setmainfont{CMU Serif}. Also, you can provide it via zip archive to the container if you have corresponding woff files :slightly_smiling_face:

time docker run --rm -it -v $(pwd):$(pwd) -v $(pwd)/common:$(pwd)/../common \
  babbage/latex-dstu bash -c \
  "cd $(pwd) && unzip TimesNewRoman.zip -d /usr/local/texlive/2015/texmf-dist/fonts/truetype/ && rm /usr/local/texlive/2015/texmf-dist/fonts/truetype/TimesNewRoman*/*.woff && ./xelatex-build-bib.sh"
curldivergence commented 2 years ago

Thanks a lot for your fast reply and kind help :) I've already moved my local changes to XeLaTeX, too, but unfortunately my setup has diverged from yours in a number of really dirty ways a while ago so making a PR is not an easy task :( Also I've got a couple of questions, if you don't mind:

Also, along with getting rid of the inputenc package I needed to set up polyglossia like this

\usepackage{polyglossia}
\setmainlanguage{ukrainian}
\setotherlanguage{english}
\setmainfont{Times New Roman}
\setromanfont{Times New Roman}
\newfontfamily{\cyrillicfont}{Times New Roman}[Ligatures=TeX] % this is needed for << to be converted into «
\newfontfamily{\cyrillicfontrm}{Times New Roman}
\newfontfamily{\cyrillicfonttt}{Courier New}
\newfontfamily{\cyrillicfontsf}{Arial}
\setkeys{ukrainian}{babelshorthands=true}

As I understand, it is an alternative to xecyr package you've mentioned above? Oh, and one more thing - the indentfirst package stopped working for me, I've managed to work it around like this:

-\usepackage{titlesec}
+\usepackage[indentafter]{titlesec}

Thank you!

definability commented 2 years ago

@curldivergence

is this a typo, by any chance?

Yes, there is an error. Here is my current script

set -e

mkdir -p tmp
cp bibliography.bib tmp
xelatex -output-directory tmp -synctex=1 -interaction=nonstopmode index.tex
cd tmp
bibtex index
cd -
xelatex -output-directory tmp -synctex=1 -interaction=nonstopmode index.tex
xelatex -output-directory tmp -synctex=1 -interaction=nonstopmode index.tex
cp tmp/index.pdf .
cp tmp/index.synctex.gz .
echo 'SUCCESS'

page count has grown by ~15%

I didn't face such issues :thinking: At least I didn't compare results before and after — I just cared about the correctness of text and standard compliance.

As I understand, it is an alternative to xecyr package you've mentioned above?

I don't remember. I've tried a lot of different approaches to enabling TNR with Cyrillic symbols and left the shortest of the working ones. Maybe polyglossia didn't work for me for some reason :slightly_smiling_face:

he indentfirst package stopped working for me

Interesting, it seems to work for me without this change.

curldivergence commented 2 years ago

Got it, thank you very much for your help :) I guess we can close the issue.

definability commented 2 years ago

@curldivergence not yet. I should fix it :smile: I want to perform a migration to XeLaTeX.

curldivergence commented 2 years ago

@char-lie Oh sorry, one more question (unrelated) - by any chance, do you know how to capitalize the chapter names in the contents?

definability commented 2 years ago

@curldivergence, no, have to google it