[Beamer/Latex]: Getting \part name from different part - latex

Hi I would like to create some sort of my own table of content in beamer presentation where there will be all parts with all sections listed.
To this moment I came up with this solution to list all \tableofcontents in one slide
\begin{frame}
\begin{multicols}{2}
\setcounter{tocdepth}{1}
\foreach\x in {1,...,\totvalue{part}}{%
\vskip 0.4cm
\tableofcontents[part=\x]%
}%
\setcounter{tocdepth}{2}
\end{multicols}
\end{frame}
Problem here is that I get section of each part but there is not partname listed.
Is there way how to access name of part by index \x of for-cycle? Something like \insertpart[\x]?

Ok with help of one co-student of mine I came up with solution to my problem.
\makeatletter
\AtBeginPart{
\write\#auxout{%
\noexpand\expandafter\noexpand\gdef\noexpand\csname
part\thepart name\noexpand\endcsname{\beamer#partname}}
}
\makeatother
\begin{document}
\frame{\maketitle}
\section*{Outline}
\begin{frame}{Outline of Presentation}
\begin{multicols}{2}
\setcounter{tocdepth}{1}
\foreach\x in {1,...,\totvalue{part}}{%
\medskip\expandafter\let\expandafter\partname
\csname part\x name\endcsname
\penalty-999
\textit{\partname}
\medskip
{\let\vfill=\relax\tableofcontents[part=\x]}\vfill
\penalty-999
}%
\setcounter{tocdepth}{2}
\end{multicols}
\end{frame}
Unfortunately I cannot write down deep description of how exactly it works but basically it takes names of parts during first run of pdflatex and saves them into .aux file. Then during second run of pdflatex it will correctly print them out. Then negative penalty is added to each block so partname is not splitted out of rest of part-toc.
So two runs of pdflatex are needed to work it correctly but it should work quite nicely. I managed to create table of content with 4 parts.
example
Hopefully it will help someone.

Related

affiliations and corresponding author comment as footnotes on latex article

I am trying to use the LaTeX article document class to create a simple paper with the authors listed on the title page with their (potentially multiple repeating) affiliations as numeric footnotes and other author comments as symbolic footnotes. For example, I want something like
However, I haven't been able to make this happen despite trying multiple different solutions. Is there a simple way to do this?
I have tried using the bigfoot package to create multiple different types of footnotes combined with footmisc with the multiple option to get multiple footnote markers with commas between them, but I end up with superposed markers and no footnotes. My minimal latex document is:
\documentclass{article}
\title{My title}
\usepackage[multiple]{footmisc}
\usepackage{bigfoot}
\DeclareNewFootnote{AAffil}[arabic]
\DeclareNewFootnote{ANote}[fnsymbol]
\author{
David Kaplan\footnoteAAffil{A University}\footnoteAAffil{Another University}\footnoteANote{Corresponding author}\footnoteANote{Equal contributors}
\and
Prince Charming\FootnotemarkAAffil{2}\FootnotemarkANote{2}
}
\date{\today}
\begin{document}
\maketitle
\end{document}
And the output I get is:
One possibility is to switch to the amsart class and then using the amsaddr package:
\documentclass{amsart}
\title{My title}
\author{David Kaplan $^{1,2,\ast,\dagger}$}
\address{$^1$A University}
\address{$^2$Another University}
\address{$^{\ast}$Corresponding author}
\address{$^{\dagger}$Equal contributors}
\author{Prince Charming $^{1,\dagger}$}
\usepackage[foot]{amsaddr}
\begin{document}
\maketitle
\end{document}
With help from others, I posted a solution to this question here. For completeness, I am copying the solution below:
\documentclass{article} % <---- No titlepage
\title{My title}
%\usepackage[dont-mess-around]{fnpct} % <---- I decided not to use fnpct, but rather put in the commas by hand
\usepackage{bigfoot}
\DeclareNewFootnote{AAffil}[arabic]
\DeclareNewFootnote{ANote}[fnsymbol]
\usepackage{etoolbox}
\makeatletter
\patchcmd\maketitle{\def\#makefnmark{\rlap{\#textsuperscript{\normalfont\#thefnmark}}}}{}{}{}
\makeatother
% Hook into the \thanks command for the article class to print the footnotes
\makeatletter
\def\thanksAAffil#1{% <--- These %'s are necessary for spacing
\footnotemarkAAffil\protected#xdef\#thanks{\#thanks%
\protect\footnotetextAAffil[\the \c#footnoteAAffil]{#1}}%
}
\def\thanksANote#1{%
\footnotemarkANote%
\protected#xdef\#thanks{\#thanks%
\protect\footnotetextANote[\the \c#footnoteANote]{#1}}%
}
\makeatother
\author{% <---- Not sure if these %'s are necessary, but can't hurt
David Kaplan%
\thanksAAffil{A University}$^{,}$\thanksAAffil{Another University}$^{,}$%
\thanksANote{Corresponding author}$^{,}$\thanksANote{Equal contributors}%
, %
Prince Charming%
\footnotemarkAAffil[2]$^{,}$\thanksAAffil{Still another university}$^{,}$\footnotemarkANote[2]$^{,}$%
\thanksANote{Another note}%
, %
Mohamed Ali%
\thanksAAffil{I am the greatest U.}%
}
\date{\today}
\begin{document}
\maketitle
\begin{abstract}
This is the abstract.
\end{abstract}
\section{Introduction}
More Text
\end{document}

\maketitle to use several times with combine in LaTeX

I am trying to make a .tex template for a book of abstracts for the conference. I want the template to be compilable, so the participants are able to see their abstracts separately before submitting. Moreover I want to use the files to compile the book of abstracts with table of contents and titles.
So, I have master file
\documentclass[12pt]{combine}
\usepackage{authblk}
\begin{document}
\tableofcontents
\begin{papers}
\coltocauthor{Crist\'{o}bal Josevich Junta, Fyodor Simeonovich Kivrin}
\coltoctitle{Title of the first abstract}
\import{first}
\coltocauthor{Roman Oyra-Oyra}
\coltoctitle{Title of the second abstract}
\import{second}
\end{papers}
\end{document}
And two imported files are:
\documentclass{article}
\usepackage{authblk}
\title{Title of the first abstract}
\author[1]{Crist\'{o}bal Josevich Junta}
\author[2]{Fyodor Simeonovich Kivrin}
\affil[1]{Department of the Meaning of Life}
\affil[2]{Department of Linear Happiness}
\begin{document}
\maketitle
Text of the first abstract.
\end{document}
and
\documentclass{article}
\usepackage{authblk}
\title{Title of the second abstract}
\author[1]{Roman Oyra-Oyra}
\affil[1]{Laboratory of the most unexpected sciences}
\begin{document}
\maketitle
Text of the second abstract.
\end{document}
The problem is the second \maketitle does not print authors names and their affiliation.
I have tried using redefined \settitle instead of \maketitle
\makeatletter
\newcommand{\settitle}{\#maketitle}
\makeatother
it did not help.
Also, I tried titling package, which led to no change.
I want \maketitle to print the names and affiliations or to find out the better way to automatically make titles for each abstract.

How to reset chapter and section counter with \part*

Sorry for bad english
I have a problem with my Latex code (I'm not very good in coding). I want an output like this:
Part I
Chapter I
Chapter II
Part II
Chapter I
Chapter II
I also wanted to create a box around my title of the parts , this doesn't work like I wanted, so I used \part* and \addcontentsline{toc}{part}{PART I} (to write the line in the table of content).So the code is:
\fbox{\begin{minipage}{\linewidth}
\part*{\begin{center}
PART I
\end{center}}
\end{minipage}}
\addcontentsline{toc}{part}{PART I}
\vspace{0.7cm}
I saw this methode to reset the counter of the chapters:
\makeatletter
\#addtoreset{chapter}{part}
\makeatother
but this doesn't work, I think it's due to use of \part*.
Has anyone an idea? THNANKS!
Hope the example bellow can help:)
\documentclass[a4paper,11pt,]{report}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\newpage
\fbox{\begin{minipage}{\linewidth}
\part*{\begin{center}
INTRODUCTION
\end{center}}
\end{minipage}}
\addcontentsline{toc}{part}{INTRODUCTION}
\vspace{0.7cm}
\chapter{Hello}
\section{my}
\newpage
\fbox{\begin{minipage}{\linewidth}
\part*{\begin{center}
CONCLUSION
\end{center}}
\end{minipage}}
\addcontentsline{toc}{part}{CONCLUSION}
\vspace{0.7cm}
\chapter{name}
\section{is}
\end{document}
As you already know the solution for \part, how about simply using this and make it look like \part*? This has the advantage that you could add the boxes around the part titles automatically.
\documentclass[a4paper,11pt,]{report}
\usepackage[newparttoc]{titlesec}
\titleformat{\part}[frame]
{\normalfont}
{}
{8pt}
{\Large\bfseries\filcenter}
\usepackage{titletoc}
\titlecontents{part}[0em]
{\vspace{2em}\large\bfseries\sffamily\relax}
{\contentslabel[\relax]{0em}}{}{\hfill\contentspage}
\usepackage{hyperref}
\makeatletter
\#addtoreset{chapter}{part}
\makeatother
\begin{document}
\tableofcontents
\part{INTRODUCTION}
\chapter{Hello}
\section{my}
\part{CONCLUSION}
\chapter{name}
\section{is}
\end{document}

How to wrap LaTex command in new environment

This question has already been answered once (wrap LaTeX command in environment), yet I still struggle to make my own rather simple new environment command work.
What I wanted to do is to convert the following LaTex block, which shows the output of some code, into a command I can reuse.
\fbox{\begin{minipage}{\textwidth}
\texttt{
>> CODE OUTPUT
\end{minipage}}
It is clear that in order to make a new environment command that replicates what I do above, I will have to make use of wrappers. (Because of the \fbox and the \texttt command.)
I would like to do this without having to download yet another package, or going into the secret realms of LaTex with some predefined \dir command that is only there to do the same job twice.
Checking the link from before, it seems that a productive solution is to use \bgroup and \egroup. I would therefore write something like this:
\newenvironment{CodeOutput}
{\fbox\bgroup\begin{minipage}{\textwidth}\texttt\bgroup}
{\egroup\end{minipage}\egroup}
Yet this will still not work. (On Overleaf at least.) It would be great if there was a straightforward way of making commands like these. Thanks for any useful suggestions!
If want to write a command that does what you're after, then the following would work:
\newcommand{\mycmd}[1]{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily #1
\end{minipage}%
}%
}
The idea here works because the <arg>ument supplied to \mycmd{<arg>} is replaced by #1 in its entirety. If you want want to rewrite this as an environment, it's a little more difficult, purely because of \fbox. \fbox is doesn't have an environment-form equivalent the same way \texttt has \ttfamily (which is technically a font switch). There is a quick way around it provided by environ - it allows you to capture the contents of an environment in a macro \BODY:
\usepackage{environ}
\NewEnviron{myenvA}{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily \BODY
\end{minipage}%
}%
}
However, you do have the option by capturing the content of an environment inside a box and then setting the box inside an \fbox:
\newsavebox{\codebox}% To store the content of myenvB
\newenvironment{myenvB}{%
\begin{lrbox}{\codebox}%
\ttfamily\ignorespaces
}{%
\end{lrbox}%
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\usebox{\codebox}%
\end{minipage}}%
}
The following minimal example shows all the above cases:
\documentclass{article}
\usepackage{environ}
\newcommand{\mycmd}[1]{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily #1
\end{minipage}%
}%
}
\NewEnviron{myenvA}{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily \BODY
\end{minipage}%
}%
}
\newsavebox{\codebox}
\newenvironment{myenvB}{%
\begin{lrbox}{\codebox}%
\ttfamily\ignorespaces
}{%
\end{lrbox}%
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\usebox{\codebox}%
\end{minipage}}%
}
\begin{document}
\noindent
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily SoMe CoDe HeRe
\end{minipage}}
\bigskip
\noindent
\mycmd{SoMe CoDe HeRe}
\bigskip
\noindent
\begin{myenvA}
SoMe CoDe HeRe
\end{myenvA}
\bigskip
\begin{lrbox}{\codebox}
\ttfamily SoMe CoDe HeRe
\end{lrbox}
\noindent
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\usebox{\codebox}
\end{minipage}}
\bigskip
\noindent
\begin{myenvB}
SoMe CoDe HeRe
\end{myenvB}
\end{document}

No page number for divider pages in LaTeX

I have a report in LaTeX, and i have used the following commands to create my Appendix, however, my lecturer states that any divider pages should be unnumbered.
\documentclass{report}
\usepackage{appendix}
\begin{document}
\include{chap1}
\include{appendix}
\end{document}
Then in appendix.tex
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
This creates the Appendices divider page, but still puts a page number on it in the footer. There is no page number in the TOC, as expected.
How can I remove it from the footer?
I looked at the appendix.sty source, and I see the problem: line 74, in the definition of \#chap#pppage, issues a \thispagestyle{plain} command, thus overriding your \pagestyle{empty} for this page. The inelegant but direct way to fix this is to redefine the command without this line - issue the following code after importing the package.
Revised, tested version
\documentclass{report}
\usepackage{appendix}
%==== The action ================
\makeatletter
\def\#chap#pppage{%
\clear#ppage
\if#twocolumn\onecolumn\#tempswatrue\else\#tempswafalse\fi
\null\vfil
\markboth{}{}%
{ \centering \interlinepenalty \#M
\normalfont \Huge \bfseries \appendixpagename\par}%
\if#dotoc#pp\addappheadtotoc\fi
\vfil\newpage
\if#twoside
\if#openright \null \thispagestyle{empty}\newpage\fi
\fi
\if#tempswa \twocolumn\fi
}
\makeatother
%==== Back to the document ========
\begin{document}
\tableofcontents
\chapter{Blah}
Rhubarb, rhubarb, rhubarb.
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
\chapter{Boff}
Cabbages, cabbages, cabbages.
\end{document}
The TeX FAQ might come in handy here:
I asked for “empty”, but the page is numbered
If you use \pagestyle{empty} and you
find some pages are numbered anyway,
you are probably encountering one of
the style decisions built into the
standard LaTeX classes: that certain
special pages should always appear
with \pagestyle{plain}, with a page
number at the centre of the page foot.
The special pages in question are
those (in article class) containing a
\maketitle, or (in book and report
classes) \chapter or \part commands.
The simple solution is to reissue the
page style after the command, with
effect for a single page, as, for
example (in article):
\maketitle
\thispagestyle{empty}
So give adding \thispagestyle{empty} after your \appendix a try.
try changing \pagestyle{empty} to \thispagestyle{empty} and put it after \addappheadtotoc.
Try instead:
\pagenumbering{gobble}
\begin{appendices} \newpage
\clearpage
\pagenumbering{arabic}
\addtocounter{page}{100}
\tableofcontents
\newpage
*Special thanks to https://tex.stackexchange.com/questions/6639/removing-page-numbers-but-not-headers!

Resources