%EB%A0%88%EC%9D%B4%EB%B8%94%EC%97%90%20%EB%8C%80%ED%95%9C%20%EC%82%AC%EC%9A%A9%EC%9E%90%20%EC%A0%95%EC%9D%98%20%EC%B0%B8%EC%A1%B0%20%ED%85%8D%EC%8A%A4%ED%8A%B8(%ED%95%98%EC%9C%84%20%EA%B7%B8%EB%A6%BC%EA%B3%BC%20%EA%B0%99%EC%9D%80%20tcolorbox%EC%9D%98%20%EA%B2%BD%EC%9A%B0).png)
이유로부동 소수점은 tcolorbox에 중첩될 수 없습니다.그리고 나는 내 (하위)그림을 더 멋지게 만들고 싶었고 새롭고 새로운 colorbox 환경을 코딩 Figure
했습니다 Subfigure
. 내 코드의 단순화된 버전은 다음과 같습니다.
\documentclass[12pt,a4paper]{book}
\usepackage{lipsum}
\usepackage[skins, breakable]{tcolorbox}
\newcommand{\figref}[1]{Figure \ref{fig:#1}}
\newtcolorbox[auto counter]{Figure}[1]{
title = {Figure~\thetcbcounter~$-$ #1}
}
\newtcolorbox[
auto counter,
number within=tcb@cnt@Figure,
number freestyle = {(\noexpand\alph{\tcbcounter})}
]
{Subfigure}[3][]{
width = (\linewidth - 4\dimexpr (#2pt - 1pt)\relax)/#2,
before =,
after = \hfill,
box align = center,
title = {\thetcbcounter~#3},
#1
}
\begin{document}
\begin{Figure}
{Title figure}
\begin{Subfigure}[label={fig:a}]{2}
{Title again}
\lipsum[1]
\end{Subfigure}%
%
\begin{Subfigure}{2}
{A nice Subfigure}
\lipsum[2]
\end{Subfigure}
\end{Figure}
See \figref{a}.
\end{document}
출력과 함께
결과는 마음에 들지만 하위 그림의 제목을 변경하지 않고 대신 Figure 1a
텍스트 를 인쇄하고 싶습니다 . 보다 정확하게는 newtcolorbox의 인수를 내 하위 그림의 카운터로 Figure (a)
변경할 수 있지만 이로 인해 내가 원하지 않는 제목이 변경됩니다.number freestyle
1a
(a) blabla
1a blabla
hyperref
최소 작업 예제에서 패키지를 제거한 경우에도 패키지를 사용합니다 .
나는 알고있다비슷한 질문질문을 받았지만 무엇을 이해하지 못하기 때문에 내 질문과 얼마나 가까운지 모르겠습니다.
\makeatletter
\newcommand{\customlabel}[2]{%
\protected@write \@auxout {}{\string \newlabel {#1}{{#2}{}}}}
\makeatother
하고있다...
답변1
다음을 사용하여 라벨 형식을 변경할 수 있습니다 \labelformat
(참조:ltnews30.pdf
자세한 내용은):
\documentclass[12pt,a4paper]{book}
\usepackage{lipsum}
\usepackage[skins, breakable]{tcolorbox}
\newcommand{\figref}[1]{Figure \ref{fig:#1}}
\newtcolorbox[auto counter]{Figure}[1]{
title = {Figure~\thetcbcounter~$-$ #1}
}
\newtcolorbox[
auto counter,
number within=tcb@cnt@Figure,
number freestyle = {(\noexpand\alph{\tcbcounter})}
]
{Subfigure}[3][]{
width = (\linewidth - 4\dimexpr (#2pt - 1pt)\relax)/#2,
before =,
after = \hfill,
box align = center,
title = {\thetcbcounter~#3},
#1
}
\labelformat{tcb@cnt@Subfigure}{\arabic{tcb@cnt@Figure}\alph{tcb@cnt@Subfigure}}
\begin{document}
\begin{Figure}
{Title figure}
\begin{Subfigure}[label={fig:a}]{2}
{Title again}
\lipsum[1]
\end{Subfigure}%
%
\begin{Subfigure}{2}
{A nice Subfigure}
\lipsum[2]
\end{Subfigure}
\end{Figure}
See \figref{a}.
\end{document}
그런데: cleveref
자신만의 \figref
.