% \iffalse meta-comment % % This is file `bicaption.dtx'. % % Copyright (C) 2010-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2003/12/01 or later. % % This work has the LPPL maintenance status "maintained".F % % This Current Maintainer of this work is Axel Sommerfeldt. % % This work consists of the files caption.ins, caption.dtx, caption2.dtx, % caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, % the derived files caption.sty, caption2.sty, caption3.sty, % bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi % \CheckSum{369} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesFile{bicaption.drv}[2011/10/30 v1.0 Adds a bilingual caption feature to the caption package] \hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up. %\errorcontextlines=3 % \documentclass[german,english]{ltxdoc} \setlength\parindent{0pt} \setlength\parskip{\smallskipamount} % \newcommand\LineBreak{\linebreak[3]} \newcommand\PageBreak{\pagebreak[3]} \usepackage{ifpdf} \ifpdf \usepackage{mathptmx,courier} \usepackage[scaled=0.90]{helvet} \addtolength\marginparwidth{15pt} \ifdim\paperheight=297mm % a4paper \renewcommand\LineBreak{\\} \renewcommand\PageBreak{\clearpage} \fi \fi % \usepackage[T1]{fontenc} \usepackage[german,english]{babel} \usepackage{selinput}\SelectInputMappings{adieresis={ä},germandbls={ß}} % \usepackage[bottom]{footmisc} % \usepackage{hypdoc} \ifpdf\usepackage{hypdestopt}\fi \hypersetup{pdfkeywords={LaTeX, package, bicaption},pdfstartpage={},pdfstartview={}} % \usepackage{bicaption}[2010/09/01] \usepackage{subcaption}[2010/09/01] % \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}} \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}} \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}} \let\package\puresf \let\env\purett \let\opt\purett % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} \newcommand*\version[2][]{$v#2$} \newcommand*\x{\discretionary{}{}{}} % \usepackage{marvosym} \makeatletter \newcommand*\INFO{\@ifstar{\@INFO{}}{\@INFO{\vbox to \ht\strutbox}}} \newcommand*\@INFO[1]{\MARGINSYM{#1{\LARGE\Info}}} \makeatother % \usepackage[alpine]{ifsym} \newenvironment{background}{\par\bigskip\csname background*\endcsname}{\csname endbackground*\endcsname} \newenvironment{background*}{\small\MARGINSYM{\Mountain}\ignorespaces}{\par} % \newcommand*\MARGINSYM[1]{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{#1}}}} %\newcommand*\NEW[2]{}%\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}} % \newenvironment{Options}[1]% {\list{}{\renewcommand\makelabel[1]{\texttt{##1}\hfil}% \settowidth\labelwidth{\texttt{#1\space}}% \setlength\leftmargin{10pt}% \addtolength\leftmargin{\labelwidth}% \addtolength\leftmargin{\labelsep}}}% {\endlist} % \begin{document} \DocInput{bicaption.dtx} \end{document} % % \fi % % \let\subsectionautorefname\sectionautorefname % \let\subsubsectionautorefname\sectionautorefname % % \def\thispackage{the \package{bicaption} package} % \def\Thispackage{The \package{bicaption} package} % % \newcommand\NEWfeature{\NEW{New feature}} % \newcommand\NEWdescription{\NEW{New description}} % % \makeatletter % \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}} % \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}} % \makeatother % \newcommand*\See[1]{\nopagebreak{\small (See #1)}} % % \GetFileInfo{bicaption.drv} % \let\docdate\filedate % \GetFileInfo{bicaption.sty} % % \title{\texorpdfstring{\Thispackage\thanks{%^^A % This package has version number \fileversion, last revised \filedate.}}%^^A % {The bicaption package}} % \author{Axel Sommerfeldt\\ % \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}} % \date{\docdate} % \maketitle % % \begin{abstract} % This package supports the typesetting of bilangual captions. % \end{abstract} % % \setcounter{tocdepth}{2} % \tableofcontents % % \clearpage % \section{The user interface} % % \subsection{Loading the package} % % \DescribeMacro{\usepackage} % This package will be loaded by % \begin{quote} % |\usepackage|\oarg{options}|{bicaption}|\quad. % \end{quote} % The options for \thispackage\ are the same ones as for the \package{caption} % package and specify settings which are used for the second language % \emph{additionally}. % In fact % \begin{quote} % |\usepackage|\oarg{options}|{bicaption}| % \end{quote} % is identical to % \begin{quote} % |\usepackage{bicaption}|\\ % |\captionsetup[bi-second]|\marg{options}\quad. % \end{quote} % % \subsection{Setting options} % % \DescribeMacro{\captionsetup} % \begin{quote} % |\captionsetup[bi]|\marg{options} % \end{quote} % do setup options which will be used for bilanguage captions \emph{additionally} % to the ones which are setup for the specific floating environment. % % \begin{quote} % |\captionsetup[bi-first]|\marg{options} % \end{quote} % do setup options which will be used for the \emph{first} heading % of the bilanguage captions \emph{additionally} % to the ones which are setup for the specific floating environment % and the ones which are setup by |\captionsetup[bi]{|\ldots|}|. % % \begin{quote} % |\captionsetup[bi-second]|\marg{options} % \end{quote} % do setup options which will be used for the \emph{second} heading % of the bilanguage captions \emph{additionally} % to the ones which are setup for the specific floating environment % and the ones which are setup by |\captionsetup[bi]{|\ldots|}|. % % \bigskip % % Options specified with |\usepackage[|\ldots|]{bi|\-|caption}| and % |\caption|\-|setup[bi|\ldots|]{|\ldots|}| will override the ones specified by % |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[fig|\-|ure]{|\ldots|}| % (same for `table'). So finally we have the following order how % settings for bilingual captions are applied: % \begin{enumerate} % \item Global settings % {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)} % \item Environmental settings % {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)} % \item Local settings % {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)} % \item Custom `bi' settings % {\small(|\captionsetup[bi]{|\ldots|}|)} % \item Custom `bi-first' resp.~`bi-second' settings % {\small(|\usepackage[|\ldots|]{bicaption}| and % |\caption|\-|setup[bi-first]{|\ldots|}| % resp.~|\caption|\-|setup[bi-second]{|\ldots|}|)} % \end{enumerate} % An example: % \begin{quote} % |\usepackage[labelsep=quad,indention=10pt]{caption}|\\ % |\usepackage[labelfont=bf]{bicaption}|\\ % |\captionsetup[table]{labelfont=it,position=top}| % \end{quote} % causes the second heading of the bilingual caption inside |table| environments % to be typeset with the settings % \begin{quote} % |labelsep=quad,indention=10pt,position=top,labelfont=bf|~. % \end{quote} % % \subsection{Additional options} % % These options are available additional to the ones offered by the % \package{caption} package: % % \begin{Options}{language=} % \item[lang=] % \DescribeMacro{language=} % Sets the language of the caption, e.g. % \begin{quote}|\use|\-|package|\-|[lang=eng|\-|lish]{bi|\-|caption}|\end{quote} % will typeset the second caption of bilingual captions in English. % (The language will be set with |\select|\-|language| internally, % so the \package{babel} package must be loaded for using this option.) % % \item[bi-lang=] % \DescribeMacro{bi-lang=} % Causes a selection of the headings of bilingual captions. % \begin{quote}|\captionsetup{bi-lang=both}|\end{quote} % will cause that both caption headings are being typeset.\\ % (This is the default.) % \begin{quote}|\captionsetup{bi-lang=first}|\end{quote} % will cause that only the \emph{first} heading is being typeset, and % \begin{quote}|\captionsetup{bi-lang=second}|\end{quote} % will cause that only the \emph{second} heading is being typeset. % % \item[bi-slc=] % \DescribeMacro{bi-singlelinecheck=} % Switches the common single-line-check |on| or |off|, i.e.~when switched on % only a single check will be done for both captions, and the result will affect % both captions afterwards. So if only one caption is longer than a single line, % both captions will be treated as if they are longer than a single line, even if % the second one isn't. (The default is |on|.) % % \item[bi-swap=] % \DescribeMacro{bi-swap=} % \begin{quote}|\captionsetup{bi-swap}|\end{quote} % will swap the primary and secondary language, % making the first language the second one and vice versa. (The default is |false|.) % \end{Options} % % \subsection{The \cs{bicaption} commands} % % \DescribeMacro\bicaption % Bilingual captions will be typeset by % \begin{quote} % |\bicaption|\oarg{list entry \#1}\marg{heading \#1}\\ % | |\oarg{list entry \#2}\marg{heading \#2}\\ % |\bicaption*|\marg{heading \#1}\marg{heading \#2} % \end{quote} % The |\label| should be placed either after this command, or inside the first heading. % % \DescribeMacro\bicaptionbox % Bilingual caption boxes will be typeset by % \begin{quote} % |\bicaptionbox|\oarg{list entry \#1}\marg{heading \#1}\\ % | |\oarg{list entry \#2}\marg{heading \#2}\\ % | |\oarg{width}\oarg{inner-pos}\marg{contents}\\ % |\bicaptionbox*|\marg{heading \#1}\marg{heading \#2}\\ % | |\oarg{width}\oarg{inner-pos}\marg{contents} % \end{quote} % The |\label| should be placed inside the first heading. % % \begingroup\small % (For a description of the optional parameters \meta{width} and \meta{inner-pos} % please take a look at the \package{caption} package documentation, % \cs{captionbox}.) % \endgroup % % \bigskip % % If the \package{subcaption} package is loaded, these commands are available % additionally: % % \smallskip % % \DescribeMacro\bisubcaption % Bilingual sub-captions will be typeset by % \begin{quote} % |\bisubcaption|\oarg{list entry \#1}\marg{heading \#1}\\ % | |\oarg{list entry \#2}\marg{heading \#2}\\ % |\bisubcaption*|\marg{heading \#1}\marg{heading \#2} % \end{quote} % The |\label| should be placed either after this command, or inside the first heading. % % \DescribeMacro\bisubcaptionbox % Bilingual sub-caption boxes will be typeset by % \begin{quote} % |\bisubcaptionbox|\oarg{list entry \#1}\marg{heading \#1}\\ % | |\oarg{list entry \#2}\marg{heading \#2}\\ % | |\oarg{width}\oarg{inner-pos}\marg{contents}\\ % |\bisubcaptionbox*|\marg{heading \#1}\marg{heading \#2}\\ % | |\oarg{width}\oarg{inner-pos}\marg{contents} % \end{quote} % The |\label| should be placed inside the first heading. % % \begingroup\small % (For a description of the optional parameters \meta{width} and \meta{inner-pos} % please take a look at the \package{subcaption} package documentation, % \cs{subcaptionbox}.) % \endgroup % % \PageBreak % \subsection{A sample document} % % \begin{quote} % |\documentclass[english,ngerman]{article}|\\ % |\usepackage{selinput}|\\ % |\SelectInputMappings{adieresis={ä},germandbls={ß}}|\\ % ||\\ % |\usepackage{babel}|\\ % |\usepackage[lang=english,font=it]{bicaption}|\\ % \iffalse % |\usepackage[format=hang,list=on]{subcaption}|\\ % \else % |\usepackage[format=hang]{subcaption}|\\ % \fi % ||\\ % |\begin{document}|\\ % ||\\ % \iffalse % |\listoffigures|\\ % ||\\ % \fi % |\begin{figure}[!htb]|\\ % | \centering|\\ % | \bisubcaptionbox|\\ % | {Teilabbildung A\label{fig:test:A}}|\\ % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ % | \qquad|\\ % | \bisubcaptionbox|\\ % | {Teilabbildung langer Titel B\label{fig:test:B}}|\\ % | {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\ % | \bicaption{Deutscher Titel}{English Title}|\\ % | \label{fig:test}|\\ % |\end{figure}|\\ % ||\\ % \iffalse % |\captionsetup{bi-lang=2nd}|\\ % ||\\ % |\begin{figure}[!htb]|\\ % | \centering|\\ % | \bisubcaptionbox|\\ % | {Teilabbildung A\label{fig:test2:A}}|\\ % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ % | \qquad|\\ % | \bisubcaptionbox|\\ % | {Teilabbildung langer Titel B\label{fig:test2:B}}|\\ % | {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\ % | \bicaption{Deutscher Titel}{English Title}|\\ % | \label{fig:test2}|\\ % |\end{figure}|\\ % ||\\ % \fi % |\captionsetup{bi-lang=both}|\\ % ||\\ % |\begin{figure}[!htb]|\\ % | \centering|\\ % | \bisubcaptionbox[A]|\\ % | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\ % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ % | \qquad|\\ % | \bisubcaptionbox[B]|\\ % | {Teilabbildung B}|\\ % | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\ % | \bicaption[Abbildungsverzeichnistitel]|\\ % | {Und eine noch viel viel viel|\\ % | längere deutsche Beschriftung: Deutscher Titel}|\\ % | {Short English heading}|\\ % |\end{figure}|\\ % ||\\ % |\captionsetup{bi-slc=0}|\\ % ||\\ % |\begin{figure}[!htb]|\\ % | \centering|\\ % | \bisubcaptionbox[A]|\\ % | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\ % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ % | \qquad|\\ % | \bisubcaptionbox[B]|\\ % | {Teilabbildung B}|\\ % | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\ % | \bicaption[Abbildungsverzeichnistitel]|\\ % | {Und eine noch viel viel viel|\\ % | längere deutsche Beschriftung: Deutscher Titel}|\\ % | {Short English heading}|\\ % |\end{figure}|\\ % ||\\ % |\captionsetup{slc=0}|\\ % ||\\ % |\begin{figure}[!htb]|\\ % | \centering|\\ % | \bisubcaptionbox[A]|\\ % | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\ % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ % | \qquad|\\ % | \bisubcaptionbox[B]|\\ % | {Teilabbildung B}|\\ % | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\ % | \bicaption[Abbildungsverzeichnistitel]|\\ % | {Und eine noch viel viel viel|\\ % | längere deutsche Beschriftung: Deutscher Titel}|\\ % | {Short English heading}|\\ % |\end{figure}|\\ % ||\\ % |\end{document}| % \end{quote} % % \PageBreak % \captionsetup[bi-first]{lang=german} % \captionsetup[bi-second]{lang=english,font=it} % \captionsetup[sub]{format=hang,list=on} % % \iffalse % \listoffigures % \bigskip % \fi % % \begin{figure}[!htb] % \centering % \bisubcaptionbox % {Teilabbildung A\label{fig:test:A}} % {Subfigure A}[0.4\textwidth]{IMAGE}% % \qquad % \bisubcaptionbox % {Teilabbildung langer Titel B\label{fig:test:B}} % {Subfigure long title B}[0.4\textwidth]{IMAGE}% % \bicaption{Deutscher Titel}{English Title} % \label{fig:test} % \end{figure} % % \iffalse % \captionsetup{bi-lang=2nd} % % \begin{figure}[!htb] % \centering % \bisubcaptionbox % {Teilabbildung A\label{fig:test2:A}} % {Subfigure A}[0.4\textwidth]{IMAGE}% % \qquad % \bisubcaptionbox % {Teilabbildung langer Titel B\label{fig:test2:B}} % {Subfigure long title B}[0.4\textwidth]{IMAGE}% % \bicaption{Deutscher Titel}{English Title} % \label{fig:test2} % \end{figure} % \fi % % \captionsetup{bi-lang=both} % % \begin{figure}[!htb] % \centering % \bisubcaptionbox[A] % {Und eine gaaaanz lange Caption: Teilabbildung A} % {Subfigure A}[0.4\textwidth]{IMAGE}% % \qquad % \bisubcaptionbox[B] % {Teilabbildung B} % {Subfigure B}[0.4\textwidth]{IMAGE}% % \bicaption[Abbildungsverzeichnistitel] % {Und eine noch viel viel viel % längere deutsche Beschriftung: Deutscher Titel} % {Short English heading} % \end{figure} % % \captionsetup{bi-slc=0} % % \begin{figure}[!htb] % \centering % \bisubcaptionbox[A] % {Und eine gaaaanz lange Caption: Teilabbildung A} % {Subfigure A}[0.4\textwidth]{IMAGE}% % \qquad % \bisubcaptionbox[B] % {Teilabbildung B} % {Subfigure B}[0.4\textwidth]{IMAGE}% % \bicaption[Abbildungsverzeichnistitel] % {Und eine noch viel viel viel % längere deutsche Beschriftung: Deutscher Titel} % {Short English heading} % \end{figure} % % \captionsetup{slc=0} % % \begin{figure}[!htb] % \centering % \bisubcaptionbox[A] % {Und eine gaaaanz lange Caption: Teilabbildung A} % {Subfigure A}[0.4\textwidth]{IMAGE}% % \qquad % \bisubcaptionbox[B] % {Teilabbildung B} % {Subfigure B}[0.4\textwidth]{IMAGE}% % \bicaption[Abbildungsverzeichnistitel] % {Und eine noch viel viel viel % längere deutsche Beschriftung: Deutscher Titel} % {Short English heading} % \end{figure} % % \PageBreak % \subsection{Customising lists} % % \DescribeMacro{list=} % As default both caption texts will be insert into the List of Figures resp. List of Tables. % To suppress the second entry just pass the option |list=off| to the \package{bicaption} % package, e.g.: % \begin{quote} % |\usepackage[lang=english,|\ldots|,list=off]{bicaption}| % \end{quote} % % \pagebreak[3] % \DescribeMacro{listtype+=} % Another option is separating the lists. For that purpose the option % \begin{quote} % |listtype+=|\meta{list type extension} % \end{quote} % can be used to tell the \package{bicaption} package to use a different list % for the second caption text. % The given value will be appended to the current environment type; % for example with |listtype+=X| the list entries will be put into the list % responsible for the types % |figureX| ($=$ |figure| $+$ |X|), |tableX| ($=$ |table| $+$ |X|) etc. % % Such a \meta{list type} can be defined using |\Declare|\-|Floating|\-|Environment| % offered by the \package{newfloat} package, but some document classes % or other packages offer macros for defining new floating environment types % (and their corresponding lists) as well. % % A sample document: % \begin{quote} % |\documentclass[a4paper]{article}|\\ % ||\\ % |% Use "ngerman" as 1st language, "english" as 2nd one|\\ % |\usepackage[english,ngerman]{babel}|\\ % ||\\ % |% Load the bicaption package with 2nd language set to|\\ % |% "english", and list type "figureEng" resp. "tableEng"|\\ % |\usepackage[lang=english,listtype+=Eng]{bicaption}|\\ % ||\\ % |\usepackage{newfloat}|\\ % |% Define the new floating environment type "figureEng"|\\ % |\DeclareFloatingEnvironment[fileext=lof2]{figureEng}|\\ % | [Figure][List of Figures]|\\ % |% Define the new floating environment type "tableEng"|\\ % |\DeclareFloatingEnvironment[fileext=lot2]{tableEng}|\\ % | [Table][List of Tables]|\\ % ||\\ % |\begin{document}|\\ % |\listoffigures % typeset "Abbildungsverzeichnis"|\\ % |\listoffigureEnges % typeset "List of Figures"|\\ % ||\\ % |\begin{figure}|\\ % | \centering|\\ % | A placeholder for an image or whatever|\\ % | \bicaption{Deutscher Text}{English text}|\\ % |\end{figure}|\\ % ||\\ % |\end{document}| % \end{quote} % % \pagebreak[3] % A different approach is using one list for both languages, but with different formatting. % Since the \package{caption} package does not offer options and commands for % customising the format of the lists, one need an additional package for this purpose, % for example the \package{titletoc} package: % % \begin{quote} % |\documentclass[a4paper]{article}|\\ % ||\\ % |% Use "ngerman" as 1st language, "english" as 2nd one|\\ % |\usepackage[english,ngerman]{babel}|\\ % ||\\ % |% Load the bicaption package with 2nd language set to|\\ % |% "english", and list type "figure2" resp. "table2"|\\ % |\usepackage[lang=english,listtype+=2]{bicaption}|\\ % ||\\ % |% We load the titletoc package for customizing lists|\\ % |% Note: Loading titletoc should be done prior defining|\\ % |% additional floating environments with \DeclareFloatingEnvironment|\\ % |\usepackage{titletoc}|\\ % ||\\ % |\usepackage{newfloat}|\\ % |% Define the new floating environment type "figure2"|\\ % |% Use the same file extension as for "figure" (.lof) here|\\ % |\DeclareFloatingEnvironment[fileext=lof]{figure2}|\\ % |% Define the new floating environment type "table2"|\\ % |% Use the same file extension as for "table" (.lot) here|\\ % |\DeclareFloatingEnvironment[fileext=lot]{table2}|\\ % ||\\ % |% We use the titletoc package for customizing "figure2"|\\ % |% which is appropriate for the second language captions|\\ % \iffalse % |\contentsuse{figure2}{lof}|\\ % \fi % |\titlecontents{figure2}[3.8em]|\\ % | {} % no above code|\\ % | {} % empty numbered entry format|\\ % | {} % empty numberless entry format|\\ % | {} % empty filler page format|\\ % ||\\ % |\begin{document}|\\ % |\renewcommand\listfigurename|\\ % | {Abbildungsverzeichnis / List of Figures}|\\ % |\listoffigures|\\ % ||\\ % |\begin{figure}|\\ % | \centering|\\ % | A placeholder for an image or whatever|\\ % | \bicaption{Deutscher Text}{English text}|\\ % |\end{figure}|\\ % ||\\ % |\end{document}| % \end{quote} % % \iffalse % --------------------------------------------------------------------------- % % \fi % % \StopEventually{%^^A % } % % \iffalse % --------------------------------------------------------------------------- % % \fi % % \DoNotIndex{\\,\_,\ ,\@@par} % \DoNotIndex{\@bsphack} % \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} % \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} % \DoNotIndex{\@for,\@firstofone,\@firstoftwo} % \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} % \DoNotIndex{\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} % \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse} % \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} % \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar} % \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} % \DoNotIndex{\@testopt} % \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} % \DoNotIndex{\p@,\z@} % \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} % \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box} % \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow} % \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter} % \DoNotIndex{\fi,\footnotesize,\global} % \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss} % \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode} % \DoNotIndex{\ifx,\ignorespaces,\itshape} % \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth} % \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message} % \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox} % \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline} % \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} % \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} % \DoNotIndex{\providecommand,\quad} % \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage} % \DoNotIndex{\rightskip,\rmfamily} % \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape} % \DoNotIndex{\small,\string,\space,\strut} % \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily} % \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage} % \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip} % \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} % \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists} % \DoNotIndex{\NeedsTeXFormat,\MessageBreak} % \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine} % \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} % % \iffalse % --------------------------------------------------------------------------- % % \fi % % \setlength{\parskip}{0pt plus 1pt} % \changes{v0.1}{2010/07/13}{Initial version} % \changes{v0.2}{2010/07/13}{Check for caption package added} % \changes{v0.3}{2010/07/13}{Usage of \cs{caption@applyfont} added} % \changes{v0.4}{2010/07/13}{``Singlelinecheck'' fixed} % \changes{v0.5}{2010/07/13}{Options \opt{bi-first} and \opt{bi-second} added} % \changes{v0.6}{2010/07/13}{Option \opt{bi-slc} added} % \changes{v0.7}{2010/07/13}{Option \opt{bi-lang} added} % \changes{v0.8}{2010/09/04}{Adapted to current version of the caption kernel} % \changes{v0.9}{2010/09/17}{Option \opt{bi-swap} added} % \changes{v0.9a}{2011/07/13}{Warning regarding \package{babel} package added} % % \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}} % % \iffalse % --------------------------------------------------------------------------- % % \fi % % \clearpage % \section{The implementation} % \iffalse %<*package> % \fi % % \subsection{Identification} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{bicaption}[2011/10/30 v1.0a Bilingual Captions (AR)] % \end{macrocode} % \begin{macrocode} \RequirePackage{caption}[2011/08/28] % needs v3.2c or newer % \end{macrocode} % \changes{v1.0}{2011/09/01}{Compatibility error added} % \begin{macrocode} \caption@AtBeginDocument{\caption@ifcompatibility{% \caption@Error{% The `bicaption' package does not work correctly\MessageBreak in compatibility mode}}{}} % \end{macrocode} % % \bigskip % % \pagebreak[3] % \subsection{Initial code} % % \begin{macro}{\bicaption@Warning} % |\bicaption@Warning|\marg{message} % \begin{macrocode} \newcommand*\bicaption@Warning[1]{% \bicaption@WarningNoLine{#1\on@line}} % \end{macrocode} % \end{macro} % \begin{macro}{\bicaption@WarningNoLine} % |\bicaption@WarningNoLine|\marg{message} % \begin{macrocode} \newcommand*\bicaption@WarningNoLine[1]{% \PackageWarning{bicaption}{#1.^^J\bicaption@wh\@gobbletwo}} % \end{macrocode} % \begin{macrocode} \newcommand*\bicaption@wh{% See the bicaption package documentation for explanation.} % \end{macrocode} % \end{macro} % \begin{macro}{\bicaption@Error} % |\bicaption@Error|\marg{message} % \begin{macrocode} \newcommand*\bicaption@Error[1]{% \PackageError{bicaption}{#1}\bicaption@eh} %\let\bicaption@KV@err\bicaption@Error % \end{macrocode} % \begin{macrocode} \newcommand*\bicaption@eh{% If you do not understand this error, please take a closer look\MessageBreak at the documentation of the `bicaption' package.\MessageBreak\@ehc} % \end{macrocode} % \end{macro} % % \pagebreak[3] % \subsection{Declaration of options} % % The option |bi-lang| will setup which language(s) will actually be typeset, % the first one, the second one, or both of them. % \begin{macrocode} \newcount\bicaption@lang \DeclareCaptionOption{bi-lang}{% \caption@ifinlist{#1}{0,all,both}{% \bicaption@lang=0\relax }{\caption@ifinlist{#1}{1,1st,first}{% \bicaption@lang=1\relax }{\caption@ifinlist{#1}{2,2nd,second}{% \bicaption@lang=2\relax }{% \bicaption@Error{Undefined bi-lang value `#1'}% }}}} % \end{macrocode} % % The option |bi-singlelinecheck| will setup if a single check will be used % for both languages (|=on|), % or if both languages will be checked individually (|=off|). % \begin{macrocode} \DeclareCaptionOption{bi-singlelinecheck}[1]{% \caption@set@bool\bicaption@ifslc{#1}} \DeclareCaptionOption{bi-slc}[1]{% \caption@set@bool\bicaption@ifslc{#1}} % \end{macrocode} % % The option |bi-swap| will swap the primary and secondary language, % making the first language the second one and vice versa. % \begin{macrocode} \DeclareCaptionOption{bi-swap}[1]{% \caption@set@bool\bicaption@ifswap{#1}} % \end{macrocode} % % The option |lang=|\meta{language} will setup the language of the caption. % \begin{macrocode} \DeclareCaptionOption{lang}{\def\bicaption@language{#1}} \let\KV@caption@language\KV@caption@lang % \end{macrocode} % % \begin{macro}{\bicaption@selectlanguage} % \changes{v1.0}{2011/08/31}{Starred variant added} % Set the language via \cs{selectlanguage}. % \begin{macrocode} \newcommand*\bicaption@selectlanguage{% \@ifstar {\bicaption@select@language\select@language} {\bicaption@select@language\selectlanguage}} % \end{macrocode} % \begin{macrocode} \newcommand*\bicaption@select@language[1]{% \caption@ifundefined\bicaption@language{}{% \expandafter#1\expandafter{\bicaption@language}}} % \end{macrocode} % |\caption@applyfont| (of the \package{caption} package kernel) will be extended here % so the language setting will actually take effect. % \begin{macrocode} \g@addto@macro\caption@applyfont{% \bicaption@selectlanguage*} % \end{macrocode} % \begin{macrocode} \g@addto@macro\caption@prepareslc{% \let\bicaption@language\@undefined} % \end{macrocode} % \end{macro} % % \pagebreak[3] % \subsection{Execution of options} % % Setup default values for |bi-lang| and |bi-singlelinecheck|. % \begin{macrocode} \caption@ExecuteOptions{caption}{bi-lang=0,bi-slc=1,bi-swap=0} % \end{macrocode} % % Set the language for the first caption. % \begin{macrocode} \ifcsname bbl@main@language\endcsname \edef\@tempa{\noexpand\captionsetup[bi-first]{lang=\bbl@main@language}} \@tempa \else\ifcsname xpg@main@language\endcsname \edef\@tempa{\noexpand\captionsetup[bi-first]{lang=\xpg@main@language}} \@tempa \else \bicaption@WarningNoLine{Please load this package after the babel package} \fi\fi % \end{macrocode} % We use |\caption@ProcessOptions| here to add the options to the `|bi-second|' option % list instead of executing them immediately. % \begin{macrocode} \caption@SetupOptions{bicaption}{\captionsetup[bi-second]{#2}}% \caption@ProcessOptions*{bicaption} % \end{macrocode} % % \pagebreak[3] % \subsection{Main code} % % \begin{macro}{\caption@kernel@addcontentsline} % \changes{v1.0}{2011/08/31}{Redefinition of \cs{caption@kernel@addcontentsline} added} % We patch \cs{caption@kernel@addcontentsline} (of the \package{caption} package kernel) % so \cs{bicaption@addcontentsline} will be used for bilingual captions instead. % \begin{macrocode} \let\caption@kernel@addcontentsline@ORI\caption@kernel@addcontentsline \renewcommand*\caption@kernel@addcontentsline[2]{% \caption@ifundefined\bicaption@lentry {\caption@kernel@addcontentsline@ORI{#1}{#2}}% {\expandafter\bicaption@addcontentsline\expandafter{\bicaption@lentry}{#1}{#2}% \global\let\bicaption@lentry\@undefined}} % \end{macrocode} % \end{macro} % % \begin{macro}{\bicaption@addcontentsline} % \changes{v1.0}{2011/08/31}{This macro added} % |\bicaption@addcontentsline|\marg{list entry \#2}\marg{type}\marg{list entry \#1}\par % Typeset both captions using the original version of \cs{caption@addcontentsline}. % \begin{macrocode} \newcommand\bicaption@addcontentsline[3]{% \begingroup % \end{macrocode} % Execute the options setup with |\captionsetup[bi]{|\ldots|}|. % \begin{macrocode} \caption@setoptions{bi}% % \end{macrocode} % Do the first list entry, if requested. % \begin{macrocode} \ifnum\bicaption@lang=2\relax \else \begingroup \caption@setoptions{bi-first}% \bicaption@@addcontentsline{#2}{#3}% \endgroup \fi % \end{macrocode} % Do the second list entry, if requested. % \begin{macrocode} \ifnum\bicaption@lang=1\relax \else \begingroup \caption@setoptions{bi-second}% \bicaption@@addcontentsline{#2}{#1}% \endgroup \fi % \end{macrocode} % \begin{macrocode} \endgroup} % \end{macrocode} % \begin{macrocode} \newcommand*\bicaption@@addcontentsline[2]{% \caption@ifcontentsline{#2}{% \bicaption@selectlanguage\relax \caption@kernel@addcontentsline@ORI{#1}{#2}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\caption@@make} % We patch \cs{caption@@make} (of the \package{caption} package kernel) % so \cs{bicaption@@make} will be used for bilingual captions instead. % \begin{macrocode} \let\caption@@make@ORI\caption@@make \renewcommand\caption@@make[2]{% \caption@ifundefined\bicaption@text {\caption@@make@ORI{#1}{#2}}% {\expandafter\bicaption@@make\expandafter{\bicaption@text}{#1}{#2}% \global\let\bicaption@text\@undefined}} % \end{macrocode} % \end{macro} % % \begin{macro}{\bicaption@@make} % |\bicaption@@make|\marg{text \#2}\marg{label}\marg{text \#1}\par % Typeset both captions using the original version of \cs{caption@@make}. % \begin{macrocode} \newcommand\bicaption@@make[3]{% % \end{macrocode} % Execute the options setup with |\captionsetup[bi]{|\ldots|}|. % \begin{macrocode} \caption@setoptions{bi}% % \end{macrocode} % Perform the common single-line-check for both captions, if requested. % \begin{macrocode} \ifnum\bicaption@lang=0\relax \bicaption@ifslc {\caption@@slc{#2}{#3}{\captionwidth}{}% {\caption@set@bool\caption@ifslc0}% \caption@@slc{#2}{#1}{\captionwidth}{}% {\caption@set@bool\caption@ifslc0}}% {}% \fi % \end{macrocode} % Typeset the first caption, if requested. % (Otherwise we only apply the label of it.) % \begin{macrocode} \ifnum\bicaption@lang=2\relax \bicaption@label \global\let\bicaption@label\relax \else \begingroup \caption@setoptions{bi-first}% \caption@@make@ORI{#2}{#3}% \endgroup \fi % \end{macrocode} % Typeset the second caption, if requested. % \begin{macrocode} \ifnum\bicaption@lang=1\relax \else \begingroup \caption@setoptions{bi-second}% \caption@@make@ORI{#2}{#1}% \endgroup \fi} % \end{macrocode} % \end{macro} % % \pagebreak[3] % \subsubsection{The \cs{bicaption} commands} % % \begin{macro}{\bicaption} % |\bicaption*|\oarg{list entry \#1}\marg{text \#1}\oarg{list entry \#2}\marg{text \#2} % \begin{macrocode} \newcommand\bicaption{\@bicaption\caption} % \end{macrocode} % \end{macro} % % \begin{macro}{\bicaptionbox} % \changes{v1.0}{2011/08/31}{This macro added} % |\bicaptionbox*|\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}% % \oarg{\ldots}\marg{\ldots} % \begin{macrocode} \newcommand\bicaptionbox{\@bicaption\captionbox} % \end{macrocode} % \end{macro} % % \begin{macro}{\bisubcaption} % |\bisubcaption*|\oarg{list entry \#1}\marg{text \#1}\oarg{list entry \#2}\marg{text \#2} % \begin{macrocode} \newcommand\bisubcaption{\@bicaption\subcaption} \let\subbicaption\bisubcaption % \end{macrocode} % \end{macro} % % \begin{macro}{\bisubcaptionbox} % |\bisubcaptionbox*|\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}% % \oarg{\ldots}\marg{\ldots} % \begin{macrocode} \newcommand\bisubcaptionbox{\@bicaption\subcaptionbox} \let\subbicaptionbox\bisubcaptionbox % \end{macrocode} % \end{macro} % % \begin{macro}{\@bicaption} % \changes{v1.0}{2011/08/31}{Optional parameter \meta{list entry \#2} added} % |\@bicaption|\marg{cmd}*\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}\ldots % \begin{macrocode} \newcommand*\@bicaption[1]{% \def\bicaption@cmd{#1}% \@ifstar {\l@addto@macro\bicaption@cmd*% \@@bicaption}% {\caption@dblarg\@@@bicaption}} % \end{macrocode} % \begin{macrocode} \newcommand\@@bicaption[1]{% \@@@@bicaption{}{#1}[]} % \end{macrocode} % \begin{macrocode} \long\def\@@@bicaption[#1]#2{% \caption@dblarg{\@@@@bicaption{#1}{#2}}} % \end{macrocode} % \begin{macrocode} \long\def\@@@@bicaption#1#2[#3]#4{% \bicaption@getlabel#2\label{}\@nil \bicaption@ifswap {\bicaption@setup{#1}{#2}% \bicaption@cmd[{#3}]{#4}}% {\bicaption@setup{#3}{#4}% \bicaption@cmd[{#1}]{#2}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\bicaption@getlabel} % \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now} % Gets the label command out of the (first) caption text and stores it to |\bicaption@label|. % \begin{macrocode} \long\def\bicaption@getlabel#1\label#2#3\@nil{% \def\@tempa{#2}% \ifx\@tempa\@empty \let\bicaption@label\relax \else \def\@tempb{*}% \ifx\@tempa\@tempb \def\bicaption@label{\label*}% \bicaption@@getlabel#3\@nil \else \def\bicaption@label{\label}% \bicaption@@getlabel{#2}#3\@nil \fi \fi} % \end{macrocode} % \begin{macrocode} \long\def\bicaption@@getlabel#1#2\@nil{% \def\@tempa{#1}% \def\@tempb{[}% \ifx\@tempa\@tempb \bicaption@@@getlabel#1#2\@nil \else \l@addto@macro\bicaption@label{{#1}}% \fi} % \end{macrocode} % \begin{macrocode} \long\def\bicaption@@@getlabel[#1]#2\@nil{% \l@addto@macro\bicaption@label{[{#1}]}% \bicaption@@getlabel#2\@nil} % \end{macrocode} % \end{macro} % % \begin{macro}{\bicaption@setup} % |\bicaption@setup|\marg{list-entry}\marg{text}\par % Initiates the bilingual caption typesetting by storing the extra texts into % |\bi|\-|caption@l|\-|entry| and |\bi|\-|caption@text|. % \begin{macrocode} \newcommand\bicaption@setup[2]{% \def\bicaption@lentry{#1}% \def\bicaption@text{\ignorespaces#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\caption@freeze} % \changes{v1.0}{2011/08/31}{Redefinition of \cs{caption@freeze} added} % To make |\bicaption| work inside |SCfigure| and |FPfigure| environments we need to add % |\bi|\-|caption| to |\caption@freeze|. % \begin{macrocode} \AtBeginDocument{% \ifx\caption@freeze\@undefined \else \g@addto@macro\caption@freeze{% \let\caption@frozen@bicaption\bicaption \def\bicaption{% \caption@withoptargs\caption@SC@bicaption}% \long\def\caption@SC@bicaption#1#2{% \@ifnextchar[%] {\caption@SC@bi@caption{#1}{#2}}% {\caption@SC@bi@caption@{#1}{#2}}}% \long\def\caption@SC@bi@caption#1#2[#3]#4{% \caption@@freeze{\bicaption#1{#2}[{#3}]{#4}}% \ignorespaces}% \long\def\caption@SC@bi@caption@#1#2#3{% \caption@@freeze{\bicaption#1{#2}{#3}}% \ignorespaces}% \l@addto@macro\caption@warmup{% \let\bicaption\caption@frozen@bicaption}}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\bicaption@listof} % \changes{v1.0a}{2011/10/30}{Adapted to the newfloat package} % Make commands like |\listoffigure2s| work. % (Is this a good idea or not!?) % \begin{macrocode} \newcommand*\bicaption@declarelist[1]{% \@namedef{listof#1}{\bicaption@listof#1}} \@onlypreamble\bicaption@declarelist % \end{macrocode} % \begin{macrocode} \def\bicaption@listof#1 {\@nameuse{listof#1}} % \end{macrocode} % \begin{macrocode} \caption@ForEachType{\bicaption@declarelist{#1}} % \end{macrocode} % \end{macro} % % \iffalse % % \fi % % \iffalse % --------------------------------------------------------------------------- % % \fi % % \Finale % \endinput