%EB%8A%94%20%EC%9D%B4%EC%A0%84%EC%97%90%20%EC%9E%90%EB%8F%99%EC%9C%BC%EB%A1%9C%20%EC%A0%95%EC%9D%98%EB%90%9C%20%EB%8C%80%EB%A1%9C%20%EB%8F%99%EC%9E%91%ED%95%A9%EB%8B%88%EB%8B%A4..png)
나는 최근 각주와 각주 텍스트를 사용하여 작업하는 명령을 일반화하려고 합니다. 이를 위해 이전 호출을 테스트하는 역할을 하는 카운터를 정의하는 조건부 호출을 사용합니다.
테스트 구조에 문제가 있었지만 stackexchange의 다른 질문으로 해결되었습니다. 하지만 이제 더 이상한 문제에 직면하게 되었습니다. 그림 캡션이나 텍스트에서 명령을 호출하면 조건 테스트가 다르게 실행되는 것 같습니다. 왜 그런지 모르겠습니다.
더 이상하게도 고전적인 그림이나 ffimgbox를 사용하는 그림에서 호출하면 다르게 동작합니다.
문제를 설명하기 위한 테스트 코드는 다음과 같습니다. (나는 테스트를 위해 tux.png를 사용합니다.https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png)
%%%%%%%%%%% LOT OF PACKAGES AND DEFINITIONS %%%%%%%%%%
\documentclass[a4paper,12pt,oneside,final, DIV=12, listof=totoc, bibliography=totoc, toc=bibliography, open=right, chapterprefix=true]{scrbook}
\usepackage[greek,english,french]{babel}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[final]{hyperref}
\usepackage{footnotehyper}
\usepackage{footnotebackref}
\usepackage{tablefootnote}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage[format=plain, font=small, labelfont=bf, textfont=it]{caption}
\usepackage{floatrow}
\usepackage{perpage}
\MakePerPage{footnote}
\usepackage[float=false]{scrhack}
%%%%%%%%%%% LOT OF PACKAGES AND DEFINITIONS END %%%%%%%%%%
%%%%%%%%%%% BEGENNING OF THE WORK ON FOOTNOTES %%%%%%%%%%
%%% Counter for making unique ID for the footnotemark and footnotetext without [] %%%%%%
\newcounter{myHyperFootnoteCounterMARK}
%%%%% Counter for testing in which branch of testing we go %%%%%%
\newcounter{lalala}
%
\makeatletter
%%%%% define an new footnote with optional argument : the IF never reach the undefined case, the counter "lala" is never incrememented and "BA" is only shown in the text : i have tested diverses formulation \@ifundefined \ifcsname etc etc... %%%%%
\newcommand{\myOptHyperFootnotetext}[2][plop]{
\def\myFootnoteTagtextARGU{hfoi:#1}
\def\mysavee{saved@Href@#1}
%
\ifcsname c@counter@Href:#1\endcsname
% CASE DEFINED
AA\thelalala
%
\expandafter\let\expandafter\Hy@footnote@currentHref\csname\mysavee\endcsname%
\footnotetext{\hyperref[\myFootnoteTagtextARGU]{$\uparrow$}~#2}%
%
\else
% CASE UNDEFINED
AB\stepcounter{lalala}
%
\expandafter\let\expandafter\Hy@footnote@currentHref\csname\mysavee\endcsname
\footnotetext{\hyperref[\myFootnoteTagtextARGU]{$\uparrow$}~#2}
%definition of the counter if it is undifined
\newcounter{counter@Href:#1}
%
\fi
}
\newcommand{\myOptHyperFootnotemark}[1][plop]{%
\def\myFootnoteTagtextargu{hfoi:#1}%
\def\mysave{saved@Href:#1}%
%
\ifcsname c@counter@Href:#1\endcsname
% CASE DEFINED
BA\thelalala
%
\label{\myFootnoteTagtextargu}
\footnotemark \global\expandafter\let\csname\mysave\endcsname\Hy@footnote@currentHref%
\else
% CASE UNDEFINED
BB\stepcounter{lalala}
\label{\myFootnoteTagtextargu}
\footnotemark \global\expandafter\let\csname\mysave\endcsname\Hy@footnote@currentHref%
%definition of the counter if it is undifined
\newcounter{counter@Href:#1}
%
\fi
}
%
\makeatother
%%%%%%% some package %%%%%%%
\KOMAoptions{DIV=last}
%%%%%% begin %%%%%%%
\begin{document}
%%%%%% TEST %%%%%%
\chapter{TEST}
\section{Introduction}
Texttest
%%%%%%%% uncomment this to test the code when it works outisde the figure %%%%%%%%
%\myOptHyperFootnotemark[truc]
%%%%%%%% Uncomment to test the code in a classic figure %%%%%%%%
%\begin{figure}[h]
%\centering
%\includegraphics{Tux.png}
%\caption{A caption \myOptHyperFootnotemark[truc]}
%\label{Tux}
%\end{figure}
%%%%%%%% The code calling from the caption inside a floatrow %%%%%%%%
\begin{figure}[ht]
\centering
{
\begin{floatrow}[1]
\ffigbox[\FBwidth]{\caption[blaa]{\label{Tino} BLAAAAA \myOptHyperFootnotemark[truc]}}%
{\includegraphics{Tux.png}}.
\end{floatrow}
}
\end{figure}
EEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEE
\myOptHyperFootnotetext[truc]{A footnote}%
\end{document}
이론적으로 myOptHyperFootnotetext 이전에 myOptHyperFootnotemark를 호출하면 "counter@Href:truc" 카운터가 생성되고 여기에서 이러한 함수 호출에 대한 테스트 역할을 하는 "lala" 카운터가 증가해야 합니다. 0(lala) = 카운터 생성을 호출한 적이 없으며 다른 숫자 -> 생성이 호출되었습니다.
그리고 텍스트에서 호출된 코드의 주석 해제 부분에서 작동합니다. 텍스트에 "BB"("나는 함수의 할당 블록에 있음"을 의미함)와 각주에 "AA1"(해당 이름을 가진 카운터가 이미 할당되었으므로 나는 함수의 할당 블록에 있음을 의미)을 얻습니다. 할당되지 않은 블록). 이것이 원했던 결과이고 논리적입니다. 이는 또한 테스트가 작동한다는 것을 증명합니다.
그러나 그림에서 동일한 작업을 수행하면 결과가 동일하지 않습니다(테스트를 위해 주석 처리를 해제하기 위해 코드의 일부를 주석 처리했습니다). 고전적인 그림에서는 텍스트에 "BA1"이 있고 각주에 "AA1"이 있습니다. 둘 다 의미합니다. 다른 지점에서 변수를 생성하는 코드가 호출되었지만 여기에는 없습니다(그러나 어디에 ? ... ).
BA0 및 AA0을 표시하는 floatrow 환경(내 목표)에서 호출하면 결과가 더욱 이상해집니다. 이는 "할당 함수를 호출한 적이 없지만 어쨌든 카운터 존재 테스트를 통과했습니다..."를 의미합니다.
이 마지막 변형은 나에게 매우 이상하며 그것이 어떻게 가능할 수 있는지 정말로 이해하지 못합니다.
나는 어떤 도움이라도 받아들인다 ;)
답변1
이 질문에 대한 전체 답변은 다음 질문에서 @frougon이 제공했습니다. 여러 편집 및 수치에 저항하는 강력한 조건부 라벨링을 만드는 방법은 무엇입니까?
약간 기술적이지만 작동합니다(카운터나 라벨 등에서).
전체 답변을 얻으려면 이 페이지에 보고하세요. ;)