Changing University name, thesis title e.a. for abstract in different language - latex

I need to write two different abstracts in my thesis in german and in english. The German one works fine and by using the \begin{otherlanguage} command, the abstract name itself changes to english. But furthermore I need to use an english tilte, university name, faculty name and company name for the second abstract. I tried using \renewcommand but it does not change the title in the output file, which is still german.
I found packages for multiple titles (\titling), but that is not working for the university name and so on.
Thank you in advance
\documentclass[11pt, english, ngerman,]{MastersDoctoralThesis}
\thesistitle{Title in German}
\university{University Title in German}
\begin{document}
\begin{abstract}
\addchaptertocentry{\abstractname}
German German German
\end{abstract}
\begin{otherlanguage}{english}
\renewcommand{\thesistitle}{Title in English}
\renewcommand{\university}{University Title in English}
\begin{abstract}
English English English
\end{abstract}
\end{otherlanguage}

% This template was downloaded from:
% http://www.LaTeXTemplates.com
% Template license:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
\documentclass[11pt, english, ngerman,openany]{MastersDoctoralThesis}
\usepackage{blindtext}
\thesistitle{Wombat} % Your thesis title, this is used in the title and abstract, print it elsewhere with \ttitle
\supervisor{Gerald Giraffe} % Your supervisor's name, this is used in the title page, print it elsewhere with \supname
\examiner{} % Your examiner's name, this is not currently used anywhere in the template, print it elsewhere with \examname
\degree{Doctor of Philosophy} % Your degree name, this is used in the title page and abstract, print it elsewhere with \degreename
\author{John \textsc{Smith}} % Your name, this is used in the title page and abstract, print it elsewhere with \authorname
\addresses{} % Your address, this is not currently used anywhere in the template, print it elsewhere with \addressname
\subject{Biological Sciences} % Your subject area, this is not currently used anywhere in the template, print it elsewhere with \subjectname
\keywords{} % Keywords for your thesis, this is not currently used anywhere in the template, print it elsewhere with \keywordnames
\university{Uni der Zootiere} % Your university's name and URL, this is used in the title page and abstract, print it elsewhere with \univname
\department{Institut der Angewandten Tierpflegeranalyse} % Your department's name and URL, this is used in the title page and abstract, print it elsewhere with \deptname
\group{\href{http://researchgroup.university.com}{Research Group Name}} % Your research group's name and URL, this is used in the title page, print it elsewhere with \groupname
\faculty{\href{http://faculty.university.com}{Faculty Name}} % Your faculty's name and URL, this is used in the title page and abstract, print it elsewhere with \facname
\begin{document}
\begin{abstract}
\addchaptertocentry{\abstractname}
\blindtext
\end{abstract}
\begin{otherlanguage}{english}
\makeatletter
\renewcommand{\#title}{Capybara}
\makeatother
\renewcommand{\univname}{Univerity of Zoo Animals}
\renewcommand{\deptname}{Institute for applied Something}
\begin{abstract}
\blindtext
\end{abstract}
\end{otherlanguage}
\end{document}

I do not have, neither know the package MastersDoctoralThesis.
If it includes the babel package, you can use iflang to test the active language.
\documentclass[11pt]{article}
\usepackage{iflang}
\usepackage[german]{babel}
%\usepackage[english]{babel}
\begin{document}
\IfLanguageName{german}{
German German German
}{
English English English
}
\end{document}
If your document class does not include the babel language, you can do something similar by defining a macro and testing its value with the ifthen package.
\documentclass[11pt]{article}
\usepackage{ifthen}
\def\mylanguage{german}
\begin{document}
\ifthenelse{\equal{\mylanguage}{german}}{
German German German
}{
English English English
}
\end{document}

Related

<apa7> Why is professor, course, and duedate not appearing on the title page?

I am using the LaTeX package apa7 to format my research paper. However, the professor, course, and duedate for the assignment is not appearing in the title when the \maketitle command is called while my name and affiliation appears just fine. I don't see any references to this problem on the Internet for some reason, what is the issue?
\documentclass[man,donotrepeattitle]{apa7}
\usepackage[style=apa,sortcites=true,backend=biber]{biblatex}
\addbibresource{references.bib}
\title{Natural Language Processing With GPT3:\\ More than just a cheating tool}
\shorttitle{More than just a cheating tool}
\author{Anish Goyal}
\affiliation{GSMST}
\course{American Literature and Composition}
\professor{Susan Kohanek}
\duedate{January 31, 2023}
\newcommand{\HRule}{\rule{\linewidth}{0.25mm}}
\setlength\parindent{36pt}
\begin{document}
\maketitle
\end{document}
I tried looking at the apa7 manual. I expect the course, professor, and duedate to appear on the title page as indicated on the apa formatting guide. Instead, only my name and affiliation appears.
The information is displayed if you use the student paper document mode instead of the manuscript mode:
\documentclass[stu,donotrepeattitle]{apa7}
\usepackage[style=apa,sortcites=true,backend=biber]{biblatex}
\addbibresource{references.bib}
\title{Natural Language Processing With GPT3:\\ More than just a cheating tool}
\shorttitle{More than just a cheating tool}
\author{Anish Goyal}
\affiliation{GSMST}
\course{American Literature and Composition}
\professor{Susan Kohanek}
\duedate{January 31, 2023}
\newcommand{\HRule}{\rule{\linewidth}{0.25mm}}
\setlength\parindent{36pt}
\begin{document}
\maketitle
\end{document}

Multi-language LaTeX document with dozens of languages

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)

Only print a footnote of a acronym once per page in the footnotes.- LaTeX

I want the acronym package to only print a footnote, if its not already printed on that specific page. And give the \acf{XX} the same number in the text.
It should look like this:
Text
The USA¹ are country as well as the UAE², but the USA¹ are bigger.
___________________
1 United States of America, 2 United Arabic Emirates
Next page:
The UAE¹ are still a country.
___________________
1 United Arabic Emirates
But it looks like this:
Text
The USA¹ are country as well as the UAE², but the USA³ are bigger.
___________________
1 United States of America, 2 United Arabic Emirates, 3 United States of America
Next page:
The UAE¹ are still a country.
___________________
1 United Arabic Emirates
My code:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[footnote]{acronym}
\usepackage{hyperref}
\usepackage{perpage}
\MakePerPage[1]{footnote}
\begin{document}
\section*{Acronyms}
\begin{acronym}[ECU]
\acro{USA}{United States of America}
\acro{UAE}{United Arabic Emirates}
%[...]
\end{acronym}
\newpage
\section{Text}
The \acf{USA} are a country as well as the \acf{UAE}, but the \acf{USA} are bigger.
\newpage
The \acf{USA} are still a country.
\end{document}
I tried a lot but couldnt find out a Solution on my own - Maby someone here is better in LaTeX as me and could provide me some help.
Greetings
Tristan.
When you use \acf you request a "full acronym", so you explicitly override what the package would normally do. If you use \af instead, you'll only get the footnote the first time.
As for "first time¨: the acronym package tracks whether it has spelled out the acronym already. You can reset this counter with \acresetall. This is independent of pages. In your example with the forced page break you could simply add \acresetall after \newpage. In larger documents you could add it to each \section or \chapter, or have it done automatically with the etoolbox package or look into this answer to hook it into a page break.

Using algorithm2e in English and French

I am writing my thesis with two languages, i.e. English and French. I have written algorithm using algorithm2e in English. However, in one of the sections I also need to write algorithm in French. How can I achieve this? I mean I want to change all keywords in the algorithm into French in just one section and not the whole latex document.
algorithm2e provides package options french and frenchkw. The former changes, amongst other things, the names associated with \captions in algorithm. The latter provides French keywords that you can use.
If you want to use both English and French algorithms, then load the algorithm2e package under one option, and define the additional keywords as provided by the package. Below is a small example (I don't speak French):
\documentclass{article}
\usepackage{algorithm2e}
% French keywords:
\SetKwInput{KwRes}{R\'esultat}%
\SetKwIF{Si}{SinonSi}{Sinon}{si}{alors}{sinon si}{sinon}{fin si}%
\SetKwFor{Tq}{tant que}{faire}{fin tq}%
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms in English}
\end{algorithm}
\begin{algorithm}[H]
\renewcommand{\algorithmcfname}{Algorithme}%
\SetAlgoLined
\KwData{this text}
\KwRes{how to write algorithm with \LaTeX2e }
initialization\;
\Tq{not at end of this document}{
read current\;
\eSi{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms in French}
\end{algorithm}
\end{document}
Here is the complete definition of content for English algorithms (taken from algorithm2e.sty):
\renewcommand{\listalgorithmcfname}{List of Algorithms}%
\renewcommand{\algorithmcfname}{Algorithm}%
\renewcommand{\algorithmautorefname}{algorithm}%
\renewcommand{\algorithmcflinename}{line}%
\renewcommand{\algocf#typo}{}%
\renewcommand{\#algocf#procname}{Procedure}%
\renewcommand{\#algocf#funcname}{Function}%
\renewcommand{\procedureautorefname}{procedure}%
\renewcommand{\functionautorefname}{function}%
\renewcommand{\algocf#languagechoosen}{english}%
\SetKwHangingKw{KwHData}{Data$\rightarrow$}
\SetKwInput{KwIn}{Input}%
\SetKwInput{KwOut}{Output}%
\SetKwInput{KwData}{Data}%
\SetKwInput{KwResult}{Result}%
\SetKw{KwTo}{to}
\SetKw{KwRet}{return}%
\SetKw{Return}{return}%
\SetKwBlock{Begin}{begin}{end}%
\SetKwRepeat{Repeat}{repeat}{until}%
%
\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}%
\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{end switch}%
\SetKwFor{For}{for}{do}{end for}%
\SetKwFor{ForPar}{for}{do in parallel}{end forpar}
\SetKwFor{ForEach}{foreach}{do}{end foreach}%
\SetKwFor{ForAll}{forall}{do}{end forall}%
\SetKwFor{While}{while}{do}{end while}%
Here is the complete definition of content for French algorithms (taken from algorithm2e.sty):
\renewcommand{\listalgorithmcfname}{Liste des Algorithmes}%
\renewcommand{\algorithmcfname}{Algorithme}%
\renewcommand{\algorithmautorefname}{algorithme}%
\renewcommand{\algorithmcflinename}{ligne}%
\renewcommand{\algocf#typo}{\ }%
\renewcommand{\#algocf#procname}{Proc\'edure}%
\renewcommand{\#algocf#funcname}{Fonction}%
\renewcommand{\procedureautorefname}{proc\'edure}%
\renewcommand{\functionautorefname}{fonction}%
\renewcommand{\algocf#languagechoosen}{french}%
\SetKwHangingKw{HDonnees}{Donnees$\rightarrow$}
\SetKwInput{Donnees}{Donn\'ees}%
\SetKwInput{Res}{R\'esultat}%
\SetKwInput{Entree}{Entr\'ees}%
\SetKwInput{Sortie}{Sorties}%
\SetKw{KwA}{\`a}%
\SetKw{Retour}{retourner}%
\SetKwBlock{Deb}{d\'ebut}{fin}%
\SetKwRepeat{Repeter}{r\'ep\'eter}{jusqu'\`a}%
%
\SetKwIF{Si}{SinonSi}{Sinon}{si}{alors}{sinon si}{sinon}{fin si}%
\SetKwSwitch{Suivant}{Cas}{Autre}{suivant}{faire}{cas o\`u}{autres cas}{fin cas}{fin d'alternative}%
\SetKwFor{Pour}{pour}{faire}{fin pour}%
\SetKwFor{PourPar}{pour}{faire en parall\`ele}{fin pour}%
\SetKwFor{PourCh}{pour chaque}{faire}{fin pour chaque}%
\SetKwFor{PourTous}{pour tous les}{faire}{fin pour tous}%
\SetKwFor{Tq}{tant que}{faire}{fin tq}%
If you use any of the definition containing an # (like \renewcommand{\#algocf#procname}{Proc\'edure}, for example), you'll have to surround the redefinition using a \makeatletter...\makeatother pair.

LaTeX and Bibtex: command to print a single full reference from a bib file?

I'd like to be able to print a single reference from a Bibtex .bib file anywhere in my LaTeX document—not cite it, but print the reference, exactly as it would appear in the normal bibliography listing.
So if this is a regular citation, that prints a bracketed reference:
% Normal citation, appears as bracketed reference, e.g. [2]
\cite{Kawahara:2007p1116}
I want something like the following:
\print_citation{Kawahara:2007p1116}
which should print the full citation as it appears in the bibliography, something like:
[2] S Kawahara. Half rhymes in japanese rap lyrics and knowledge of similarity. Journal of East Asian
Linguistics, Jan 2007.
Is it possible?
Use \fullcite with the biblatex package as mentioned in this answer on tex.stackexchange.
bibentry package would provide inline bibliography. Ref: http://stefaanlippens.net/bibentry.
I've not tried it out myself though.
My CV uses multibib nicely:
\usepackage[resetlabels]{multibib}
% Define bibliographies.
\newcites{j,c}{Journal Publications,Conference Publications}
\begin{document}
% Stuff here.
% Publications.
\bibliographystylej{IEEEtran}
\bibliographystylec{IEEEtran}
\nocitej{journalpaperlabel1}
\nocitej{journalpaperlabel2}
\nocitec{conferencepaperlabel1}
\bibliographyj{mybib}
\bibliographyc{mybib}
% More stuff here.
\end{document}
Edited with something less self-promoting here.
See also this answer, that provides a trick using biblatex and its category system:
\documentclass{article}
\usepackage{filecontents}
\usepackage{biblatex}
\begin{filecontents*}{\jobname.bib}
#misc{Gyro2012,
author = {Gearloose, Gyro},
title = {1st paper with a very loooooooooooong title, so it spans multiple rows},
}
#misc{Gyro2013,
author = {Gearloose, Gyro},
title = {2nd paper},
}
#misc{Stark2012,
author = {Stark, Anthony Edward},
title = {3rd paper},
}
#misc{Stark2013,
author = {Stark, Anthony Edward},
title = {4th paper},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\DeclareBibliographyCategory{enumpapers}
\newcommand{\enumcite}[1]{%
\addtocategory{enumpapers}{#1}%
\defbibcheck{key#1}{
\iffieldequalstr{entrykey}{#1}
{}
{\skipentry}}%
\printbibliography[heading=none,check=key#1]%
}
\begin{document}
\nocite{*}
\begin{enumerate}
\item \enumcite{Gyro2012}
\setcounter{enumi}{9} % Two digits to test alignment
\item \enumcite{Gyro2013}
\end{enumerate}
\printbibliography[notcategory=enumpapers]
\end{document}

Resources