我的 MWE,
\documentclass[a4paper,twoside,openany,12pt]{book}
\usepackage[left=1cm,right=1cm,top=2.5cm,bottom=2.5cm,marginparwidth=0cm,marginparsep=0cm,outer=1cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[turkish]{babel}
\usepackage{multicol}
\usepackage[listings,skins,breakable]{tcolorbox}
\usepackage{empheq}
\newcommand\B{Correct answer is \textbf{B} choice.}
\definecolor{formulzemin}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{formulzemin}{\hspace{1em}#1\hspace{1em}}}
\newcommand{\equat}[1]{\begin{empheq}[box=\mybox]{align}{#1}\end{empheq}}
\newcommand{\kutu}[2]{\begin{tcolorbox}[enhanced jigsaw,breakable,title after break=,height fixed for=none,left=0mm,right=0mm,bottom=0mm,top=0mm,colback=red!5!white,colframe=red!75!black,enforce breakable,pad at break=1mm,break at=5cm/0cm]
\textit{{#1}
\begin{flushright}
{#2}
\end{flushright}}
\end{tcolorbox}}
\begin{document}
\begin{multicols}{2}
\kutu{A circuit element whose electrical characteristic is primarily resistive is called a resistor and is represented by the symbol shown in Fig. 2.1a. A resistor is a physical device that can be purchased in certain standard values in an electronic parts store. These resistors, which find use in a variety of electrical applications, are normally carbon composition or wire- wound. In addition, resistors can be fabricated using thick oxide or thin metal films for use in hybrid circuits, or they can be diffused in semiconductor integrated circuits. Some typical discrete resistors are shown in Fig. 2.1b. 5$:$1As the resistance is decreased and becomes smaller and smaller, we finally reach a point where the resistance is zero and the circuit is reduced to that shown in Fig. 2.3b; that is, the resistance can be replaced by a short circuit. On the other hand, if the resistance is increased and becomes larger and arger, we finally reach a point where it is essentially infinite and the resistance can be replaced by an open circuit, as shown in Fig. 2.3c. Note that n the case of a short circuit where \equat{V_{Ç}=V_G \cdot \frac{1}{5}=\frac{250}{5}=50\;V\!olt\nonumber}\\ \equat{V_D=V_{Ç} \cdot \sqrt{2}=50\sqrt{2}=70{,}71\;V\!olt\nonumber}}{\B}
\end{multicols}
\end{document}
还有一些输出
-> 左侧有大空间
和-> 它可以稍微向上
它的问题似乎是断裂处=5cm/0cm。但我没法解决。
抱歉我的英语不太好。
@Thomas F. Sturm,你的代码正在我的电脑上显示,
答案1
首先,需要强调的是,环境tcolorbox
内部没有自动可中断性multicols
。只有使用break at
选项插入手动断点的可能性。这也意味着,如果在这样的框之前插入新材料,则必须手动重新调整这些断点。我打算将此功能用于短multicols
环境。如果使用了许多页材料(如屏幕截图所示),则需要进行大量手动调整。
要插入这些手动断点,必须使用选项break at
。以下是手册中的相关段落:
现在,您的 MWE 使用:
break at=5cm/0cm
这导致第一个断点位于5cm
。所有后续断点均设置为\textheight
。这给出了预期的输出:
对于此 MWE,人们将尝试通过测试适当的长度值来手动平衡列。这里,以下内容看起来不错:
break at=8cm
这会将所有断点设置为8cm
。完整源代码为:
\documentclass[a4paper,twoside,openany,12pt]{book}
\usepackage[left=1cm,right=1cm,top=2.5cm,bottom=2.5cm,marginparwidth=0cm,marginparsep=0cm,outer=1cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[turkish]{babel}
\usepackage{multicol}
\usepackage[listings,skins,breakable]{tcolorbox}
\usepackage{empheq}
\newcommand\B{Correct answer is \textbf{B} choice.}
\definecolor{formulzemin}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{formulzemin}{\hspace{1em}#1\hspace{1em}}}
\newcommand{\equat}[1]{\begin{empheq}[box=\mybox]{align}{#1}\end{empheq}}
\newcommand{\kutu}[2]{\begin{tcolorbox}[enhanced jigsaw,breakable,
title after break=,
left=0mm,right=0mm,bottom=0mm,top=0mm,colback=red!5!white,colframe=red!75!black,
%enforce breakable,% <-- never use this
break at=8cm,
pad at break=1mm,
]\textit{{#1}
\begin{flushright}
{#2}
\end{flushright}}
\end{tcolorbox}}
\begin{document}
\begin{multicols}{2}
\kutu{A circuit element whose electrical characteristic is primarily resistive
is called a resistor and is represented by the symbol shown in Fig. 2.1a. A
resistor is a physical device that can be purchased in certain standard values
in an electronic parts store. These resistors, which find use in a variety of
electrical applications, are normally carbon composition or wire- wound. In
addition, resistors can be fabricated using thick oxide or thin metal films for
use in hybrid circuits, or they can be diffused in semiconductor integrated
circuits. Some typical discrete resistors are shown in Fig. 2.1b. 5$:$1As the
resistance is decreased and becomes smaller and smaller, we finally reach a
point where the resistance is zero and the circuit is reduced to that shown in
Fig. 2.3b; that is, the resistance can be replaced by a short circuit. On the
other hand, if the resistance is increased and becomes larger and arger, we
finally reach a point where it is essentially infinite and the resistance can be
replaced by an open circuit, as shown in Fig.~2.3c. Note that n the case of a
short circuit where \equat{V_{C}=V_G \cdot
\frac{1}{5}=\frac{250}{5}=50\;V\!olt\nonumber}\\ \equat{V_D=V_{C} \cdot
\sqrt{2}=50\sqrt{2}=70{,}71\;V\!olt\nonumber}}{\B}
\end{multicols}
\end{document}
输出为:
最后,我们可以添加一些
height fixed for=all
这会将两个盒子部分的高度值设置为目标值8cm
。完整代码为:
\documentclass[a4paper,twoside,openany,12pt]{book}
\usepackage[left=1cm,right=1cm,top=2.5cm,bottom=2.5cm,marginparwidth=0cm,marginparsep=0cm,outer=1cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[turkish]{babel}
\usepackage{multicol}
\usepackage[listings,skins,breakable]{tcolorbox}
\usepackage{empheq}
\newcommand\B{Correct answer is \textbf{B} choice.}
\definecolor{formulzemin}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{formulzemin}{\hspace{1em}#1\hspace{1em}}}
\newcommand{\equat}[1]{\begin{empheq}[box=\mybox]{align}{#1}\end{empheq}}
\newcommand{\kutu}[2]{\begin{tcolorbox}[enhanced jigsaw,breakable,
title after break=,
left=0mm,right=0mm,bottom=0mm,top=0mm,colback=red!5!white,colframe=red!75!black,
%enforce breakable,% <-- never use this
break at=8cm,
height fixed for=all,
pad at break=1mm,
]\textit{{#1}
\begin{flushright}
{#2}
\end{flushright}}
\end{tcolorbox}}
\begin{document}
\begin{multicols}{2}
\kutu{A circuit element whose electrical characteristic is primarily resistive
is called a resistor and is represented by the symbol shown in Fig. 2.1a. A
resistor is a physical device that can be purchased in certain standard values
in an electronic parts store. These resistors, which find use in a variety of
electrical applications, are normally carbon composition or wire- wound. In
addition, resistors can be fabricated using thick oxide or thin metal films for
use in hybrid circuits, or they can be diffused in semiconductor integrated
circuits. Some typical discrete resistors are shown in Fig. 2.1b. 5$:$1As the
resistance is decreased and becomes smaller and smaller, we finally reach a
point where the resistance is zero and the circuit is reduced to that shown in
Fig. 2.3b; that is, the resistance can be replaced by a short circuit. On the
other hand, if the resistance is increased and becomes larger and arger, we
finally reach a point where it is essentially infinite and the resistance can be
replaced by an open circuit, as shown in Fig.~2.3c. Note that n the case of a
short circuit where \equat{V_{C}=V_G \cdot
\frac{1}{5}=\frac{250}{5}=50\;V\!olt\nonumber}\\ \equat{V_D=V_{C} \cdot
\sqrt{2}=50\sqrt{2}=70{,}71\;V\!olt\nonumber}}{\B}
\end{multicols}
\end{document}
输出为:
答案2
我找到了我想要的答案;双栏。
\documentclass[a4paper,twocolumn,12pt]{book}
...
对我来说,它运行完美(tcolorbox 和 mdframed)。事实上,它在多色环境中无法运行。感谢 @Thomas F. Sturm 和 @Christian Hupfer 的指导。