Open erotavlasme opened 5 years ago
Hi, The usage is not straightforward, as you must prepare the environment. Here is the working example, sorry for the "\PrerenderUnicode":
\PassOptionsToPackage{pdfencoding=auto,psdextra}{hyperref}
\PassOptionsToPackage{naturalnames}{hyperref}
\documentclass[aspectratio=169]{beamer}
\usepackage[italian, lithuanian, english]{babel} %enables babel to every lang supported by your document
\usepackage{ucs}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{multilanguage} % import the file with the above definitions
\PrerenderUnicode{ą}
\PrerenderUnicode{Ą}
\PrerenderUnicode{ę}
\PrerenderUnicode{Ę}
\PrerenderUnicode{š}
\PrerenderUnicode{Š}
\PrerenderUnicode{č}
\PrerenderUnicode{Č}
\PrerenderUnicode{ė}
\PrerenderUnicode{Ė}
\PrerenderUnicode{į}
\PrerenderUnicode{Į}
\PrerenderUnicode{ž}
\PrerenderUnicode{Ž}
\author[ejs]{Eugenijus Januškevičius}
%\title{Minimal working example for 'multilanguage' package}
%\hypersetup{pdflang={lt}, pdfsubject={Minimal working example for 'multilinguage' package}, pdfkeywords={beamer, multilanguage}, }
%\setdoclang{lt}{lithuanian}
%\title{Minimal working example for 'multilanguage' package}
%\hypersetup{pdflang={en}, pdfsubject={Minimal working example for 'multilinguage' package}, pdfkeywords={beamer, multilanguage}, }
%\setdoclang{en}{english}
\title{Minimal working example for 'multilanguage' package}
\hypersetup{pdflang={it}, pdfsubject={Minimal working example for 'multilinguage' package}, pdfkeywords={beamer, multilanguage}, }
\setdoclang{it}{italian}
\begin{document}
\lang{lt}{\section{Santrauka}}
\lang{en}{\section{Summary}}
\lang{it}{\section{Sommario}}
\frame{
\frametitlelang{it}{Sommario}
\frametitlelang{en}{Summary}
\frametitlelang{lt}{Santrauka}
\begin{itemize}
\item
\lang{it}{Sommario in italiano.}
\lang{en}{Summary in English.}
\lang{lt}{Lietuviška santrauka.}
\end{itemize}
}
\lang{lt}{\section{Dėstymas}}
\lang{en}{\section{Content}}
\lang{it}{\section{Italiano}}
\frame{
\frametitlelang{lt}{Pavyzdys}
\frametitlelang{en}{Example}
\frametitlelang{it}{Italiano}
\begin{itemize}
\alert<1>{
\item
\lang{it}{Questa stringa appare solo in italiano.}
\lang{en}{This string shows up only in English.}
\lang{lt}{Ši eilutė atsiranda tik lietuviškame tekste.}
}
\only<2->{
\alert<2>{
\item
\lang{it}{Questa stringa appare solo in italiano.}
\lang{en}{The second string shows up only in English.}
\lang{lt}{Ši eilutė ir vėl atsiranda tik lietuviškame tekste.}
}
}
\end{itemize}
}
\end{document}
And make sure you are correctly swiching PDF output options too.
Thank you for the fast reply. I redefined one command and I created a new command for bold word or group of words. Now it works quite well.
\newcommand{\frametitlelang}[2]{\lang{#1}{{#2}}}
\newcommand{\boldlang}[2]{\lang{#1}{\textbf{#2}}}
% https://github.com/ejs-ejs/multilanguage
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{multilanguage}[2015/10/04 Create a document in one of multiple languages]
%% USAGE
%% enable babel to every lang supported by your document
%%
%% \usepackage[italian,english,lithuanian]{babel}
%% \usepackage{multilanguage}
%%
%% set short and long language codes. The second one must be known by babel
%% This will be the language of current document
%%
%% Sections, subsections, subsubsections:
%% in the first parameter you can freely use both short or long language codes
%% \sectionlang{it}{Sezione 1}
%% \sectionlang{english}{Section 1}
%%
%% Strings will be displayed only in a certain language
%% \lang{it}{Questa stringa appare solo in italiano.}
%% \lang{en}{This string shows up only in English.}
%% \lang{lt}{Ši eilutė bus tik lietuviškame tekste.}
%%
%% When you have only two languages, you can simply rely on this if-else construct
%% \langif{it}{If vero: questo e' italiano.}{Else: this is for any language
%% different from Italian.}
%%
%% Additon for Beamer package:
%%
%% \frametitlelang - frame title in particular language, use inside \frame{}
%%
%% \frame{\frametitlelang{lt}{Literatūra: papildomas sąrašas}
%% \frametitlelang{en}{Literature: supplementary list}}
%%
\usepackage{ifthen}
\newcommand{\setdoclang}[2]
{
\main@language{#2}
\def\doclang{#2}
\def\doclangshort{#1}
}
% set short and long language codes, the second one must be known by babel
\setdoclang{en}{english}
%\setdoclang{it}{italian}
%
% Multilingual support commands
%
\newcommand{\langif}[3]
{
\ifthenelse{\equal{#1}{\doclang} \OR \equal{#1}{\doclangshort}}
{#2}
{#3}
}
\newcommand{\lang}[2]{\langif{#1}{#2}{}}
\newcommand{\sectionlang}[2]{\lang{#1}{\section{#2}}}
\newcommand{\subsectionlang}[2]{\lang{#1}{\subsection{#2}}}
\newcommand{\subsubsectionlang}[2]{\lang{#1}{\subsubsection{#2}}}
\newcommand{\frametitlelang}[2]{\lang{#1}{{#2}}}
\newcommand{\boldlang}[2]{\lang{#1}{\textbf{#2}}}
I created a minimum working example.
Now I have a problem with spaces added each time that I use \lang{}{}
or \boldlang{}{}
on word or group of words.
Do you have any idea?
Hi, I was looking for a way to write a multilanguage latex presentation and I found your solutions. I tried it with beamer, but it has some problem. For instance, titles do not work:
Moreover, the commands break the presentation links and the hierarchical organization of section, subsection and so on. Do you confirm that it is compatible with beamer? Thank you