我对 MWE 的以下封装组合有两个疑问:首先,如何在使用时转移零件编号/标签tcolorbox
?
\documentclass[a4paper,12pt]{exam}
\usepackage{tikz}
\usetikzlibrary{arrows,circuits.ee.IEC,positioning}
\usetikzlibrary{decorations.markings}
\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usepackage{graphicx,ctable,booktabs,float}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,breakable}
\usepackage[labelformat=simple]{subcaption}
\usepackage{caption}
\captionsetup[figure]{name=Fig.,font=footnotesize}
\captionsetup[subfigure]{labelformat = parens, labelsep = space, font = footnotesize}
\begin{document}
\printanswers
\unframedsolutions
\begin{questions}
\question For the network shown in Fig.~\ref{fig:2015q1a},\label{Q1}\par%
\begin{minipage}[t]{0.5\textwidth}
\begin{parts}
\part Draw a complete graph.\label{2015q1a}
\part Obtain a tie-set matrix by selecting a tree of your choice from the graph of (\ref{2015q1a}).
\part Determine a cut-set matrix by selecting another tree from the graph of (\ref{2015q1a}).
\end{parts}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\vspace{-2.5em}%
\centering%
\scalebox{0.7}{%
\begin{tikzpicture}[circuit ee IEC, x=3.5cm, y=3.5cm]
\draw (1.6,0) to (0,0.0) to [V, l=5<\volt>] (0,1.0);
\draw (0.0,1.0) to [R,l=47<\kilo\ohm>,*-*] (0.8,1.0);
\draw (0.8,0) to [C,l=247<\mu\farad>,*-*] (0.8,1.0);
\draw (0.8,1.0) to [cV, l_=$0.7\color{black}{i_x}$,-*] (1.6,1.0);
\draw (1.6,0.0) to [R,l_=1<\kilo\ohm>] (1.6,1.0);
\draw (0,1.0) to (0,1.4) to [L, l=2.5<\milli\henry>] (1.6,1.4) to (1.6,1.0);
\draw[black,-stealth] (1.3,1.45) to node[above]{$i_x$} (1.45,1.45);
\end{tikzpicture}
}% end of scalebox
\captionof{figure}{}
\label{fig:2015q1a}
\end{minipage}
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\setcounter{figure}{0} %<<>><<>><<>>
\setcounter{equation}{0} %<<>><<>><<>>
\renewcommand{\thefigure}{\thequestion(\roman{figure})} %<<>><<>><<>>
\renewcommand{\theequation}{\thequestion.\arabic{equation}} %<<>><<>><<>>
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\begin{solution}
\begin{parts}
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\part
% - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{tcolorbox}[enhanced, frame style={left color=black!5,right color=black!35,middle color=black!5!pink}, interior style={left color=green!10!white, right color=gray!10!white}, boxrule=1pt, sharpish corners, top=4pt, bottom=5pt, left=0pt, right=0pt]
% - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
Given circuit is redrawn and a complete directed graph is obtained from it:
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\begin{figure}[H]
\centering%
\begin{subfigure}[t]{0.4\textwidth}
\centering%
\scalebox{0.6}{%
\begin{tikzpicture}[circuit ee IEC,x=2.5cm,y=2.5cm,semithick,every info/.style={font=\normalsize}]
\coordinate [label=left:\textcolor{blue}{$1$}] (A) at (0.0,1.6);
\coordinate [label=\textcolor{blue}{$2$}] (B) at (1.0,1.5);
\coordinate [label=below:\textcolor{blue}{4}] (C) at (1.0,0.0);
\coordinate [label=right:\textcolor{blue}{$3$}] (D) at (2.0,1.6);
\draw (1.0,0.0) to [V, l=9<\volt>,*-*,label/align=straight] (0.0,1.5);
\draw (1.0,0.0) to (1.0,0.5) to [R, l=5<\kilo\ohm>,label/align=straight] (1.0,1.5);
\draw (1.0,0.0) to [resistor, l_=7<\kilo\ohm>,*-*,label/align=straight] (2.0,1.5);
\draw (0.0,1.5) to [cV,l=0.4$i_x$,label/align=straight] (1.0,1.5);
\draw (1.0,1.5) to [resistor, l=2<\kilo\ohm>, *-] (2.0,1.5);
\draw (2.0,1.5) to [bend right=25] (1.2,2.3)
to [R,l_=2.5<\kilo\ohm>] (0.8,2.3)
to [bend right=25] (0.0,1.5);
\draw [->] (1.1,1.3) to node[below]{$i_x$} (1.4,1.3);
\end{tikzpicture}
}
\caption{Given circuit is redrawn.}
\label{SFQ1a1}
\end{subfigure}
\quad%
\begin{subfigure}[t]{0.4\textwidth}
\centering%
\scalebox{0.6}{%
\begin{tikzpicture}[decoration={markings, mark=at position 0.57 with {\arrow[scale=2]{latex'}}},font=\large]
\coordinate [label=left:\textcolor{blue}{$1$}] (A) at (0.1,3.8);
\coordinate [label=above:\textcolor{blue}{$2$}] (B) at (2.5,3.8);
\coordinate [label=right:\textcolor{blue}{$3$}] (C) at (4.8,3.8);
\coordinate [label=below:\textcolor{blue}{$4$}] (D) at (2.5,-0.15);
\draw[postaction={decorate},thick] (0.1,3.72) to [bend right=-50] node[above] {$a$} (4.8,3.8);
\draw[postaction={decorate},thick] (0.2,3.8) to node[above] {$b$} (2.5,3.8);
\draw[postaction={decorate},thick] (2.5,3.8) to node[above] {$c$} (4.8,3.8);
\draw[postaction={decorate},thick,*-*] (2.55,-0.25) to node[left] {$d$} (0.1,3.85);
\draw[postaction={decorate},thick,*-] (2.5,3.88) to node[right] {$e$} (2.5,-0.2);
\draw[postaction={decorate},thick,*-] (4.8,3.88) to node[right] {$f$} (2.5,-0.2);
\end{tikzpicture}
}%end of scalebox
\caption{Complete directed graph of \subref{SFQ1a1}.}
\label{SFQ1a2}
\end{subfigure}
\caption{Construction of graph from the given electrical circuit.}
\label{fig:Q1a}
\end{figure}
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\end{tcolorbox}
\part A tree with twigs, $twigs$:\{b,c,e\}, has been selected by solid lines while links dashed lines in the graphs of Fig.~\ref{fig:Q1a}\subref{SFQ1a2}.%
\end{parts}
\end{solution}
\end{questions}
\end{document}
其次,问题是如何在subfigure
引用中用括号括起来?参考输出:
有人能帮助我吗?
答案1
box align=top
会将(a)
零件编号移至顶部,但稍微有点太多。
\captionsetup{subrefformat=parens}
将会提供(a)
参考。
\documentclass[a4paper,12pt]{exam}
\usepackage{tikz}
\usetikzlibrary{arrows,circuits.ee.IEC,positioning}
\usetikzlibrary{decorations.markings}
\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usepackage{graphicx,ctable,booktabs,float}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,breakable}
\usepackage[labelformat=simple]{subcaption}
\usepackage{caption}
\captionsetup[figure]{name=Fig.,font=footnotesize}
\captionsetup[subfigure]{labelformat = parens, labelsep = space, font = footnotesize,subrefformat=parens}
\begin{document}
\printanswers
\unframedsolutions
\begin{questions}
\question For the network shown in Fig.~\ref{fig:2015q1a},\label{Q1}\par%
\begin{minipage}[t]{0.5\textwidth}
\begin{parts}
\part Draw a complete graph.\label{2015q1a}
\part Obtain a tie-set matrix by selecting a tree of your choice from the graph of (\ref{2015q1a}).
\part Determine a cut-set matrix by selecting another tree from the graph of (\ref{2015q1a}).
\end{parts}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\vspace{-2.5em}%
\centering%
\scalebox{0.7}{%
\begin{tikzpicture}[circuit ee IEC, x=3.5cm, y=3.5cm]
\draw (1.6,0) to (0,0.0) to [V, l=5<\volt>] (0,1.0);
\draw (0.0,1.0) to [R,l=47<\kilo\ohm>,*-*] (0.8,1.0);
\draw (0.8,0) to [C,l=247<\mu\farad>,*-*] (0.8,1.0);
\draw (0.8,1.0) to [cV, l_=$0.7\color{black}{i_x}$,-*] (1.6,1.0);
\draw (1.6,0.0) to [R,l_=1<\kilo\ohm>] (1.6,1.0);
\draw (0,1.0) to (0,1.4) to [L, l=2.5<\milli\henry>] (1.6,1.4) to (1.6,1.0);
\draw[black,-stealth] (1.3,1.45) to node[above]{$i_x$} (1.45,1.45);
\end{tikzpicture}
}% end of scalebox
\captionof{figure}{}
\label{fig:2015q1a}
\end{minipage}
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\setcounter{figure}{0} %<<>><<>><<>>
\setcounter{equation}{0} %<<>><<>><<>>
\renewcommand{\thefigure}{\thequestion(\roman{figure})} %<<>><<>><<>>
\renewcommand{\theequation}{\thequestion.\arabic{equation}} %<<>><<>><<>>
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\begin{solution}
\begin{parts}
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\part\vadjust{\vspace{-3.3\baselineskip}}\newline
% - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{tcolorbox}[enhanced, frame style={left color=black!5,right color=black!35,middle color=black!5!pink}, interior style={left color=green!10!white, right color=gray!10!white}, boxrule=1pt, sharpish corners, top=4pt, bottom=5pt, left=0pt, right=0pt,box align=top]
% - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
Given circuit is redrawn and a complete directed graph is obtained from it:
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\begin{figure}[H]
\centering%
\begin{subfigure}[t]{0.4\textwidth}
\centering%
\scalebox{0.6}{%
\begin{tikzpicture}[circuit ee IEC,x=2.5cm,y=2.5cm,semithick,every info/.style={font=\normalsize}]
\coordinate [label=left:\textcolor{blue}{$1$}] (A) at (0.0,1.6);
\coordinate [label=\textcolor{blue}{$2$}] (B) at (1.0,1.5);
\coordinate [label=below:\textcolor{blue}{4}] (C) at (1.0,0.0);
\coordinate [label=right:\textcolor{blue}{$3$}] (D) at (2.0,1.6);
\draw (1.0,0.0) to [V, l=9<\volt>,*-*,label/align=straight] (0.0,1.5);
\draw (1.0,0.0) to (1.0,0.5) to [R, l=5<\kilo\ohm>,label/align=straight] (1.0,1.5);
\draw (1.0,0.0) to [resistor, l_=7<\kilo\ohm>,*-*,label/align=straight] (2.0,1.5);
\draw (0.0,1.5) to [cV,l=0.4$i_x$,label/align=straight] (1.0,1.5);
\draw (1.0,1.5) to [resistor, l=2<\kilo\ohm>, *-] (2.0,1.5);
\draw (2.0,1.5) to [bend right=25] (1.2,2.3)
to [R,l_=2.5<\kilo\ohm>] (0.8,2.3)
to [bend right=25] (0.0,1.5);
\draw [->] (1.1,1.3) to node[below]{$i_x$} (1.4,1.3);
\end{tikzpicture}
}
\caption{Given circuit is redrawn.}
\label{SFQ1a1}
\end{subfigure}
\quad%
\begin{subfigure}[t]{0.4\textwidth}
\centering%
\scalebox{0.6}{%
\begin{tikzpicture}[decoration={markings, mark=at position 0.57 with {\arrow[scale=2]{latex'}}},font=\large]
\coordinate [label=left:\textcolor{blue}{$1$}] (A) at (0.1,3.8);
\coordinate [label=above:\textcolor{blue}{$2$}] (B) at (2.5,3.8);
\coordinate [label=right:\textcolor{blue}{$3$}] (C) at (4.8,3.8);
\coordinate [label=below:\textcolor{blue}{$4$}] (D) at (2.5,-0.15);
\draw[postaction={decorate},thick] (0.1,3.72) to [bend right=-50] node[above] {$a$} (4.8,3.8);
\draw[postaction={decorate},thick] (0.2,3.8) to node[above] {$b$} (2.5,3.8);
\draw[postaction={decorate},thick] (2.5,3.8) to node[above] {$c$} (4.8,3.8);
\draw[postaction={decorate},thick,*-*] (2.55,-0.25) to node[left] {$d$} (0.1,3.85);
\draw[postaction={decorate},thick,*-] (2.5,3.88) to node[right] {$e$} (2.5,-0.2);
\draw[postaction={decorate},thick,*-] (4.8,3.88) to node[right] {$f$} (2.5,-0.2);
\end{tikzpicture}
}%end of scalebox
\caption{Complete directed graph of \subref{SFQ1a1}.}
\label{SFQ1a2}
\end{subfigure}
\caption{Construction of graph from the given electrical circuit.}
\label{fig:Q1a}
\end{figure}
% ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
\end{tcolorbox}
\part A tree with twigs, $twigs$:\{b,c,e\}, has been selected by solid lines while links dashed lines in the graphs of Fig.~\ref{fig:Q1a}\subref{SFQ1a2}.%
\end{parts}
\end{solution}
\end{questions}
\end{document}