
フレームのタイトルをフレームの中央に配置する新しい環境を定義しました
\newenvironment{coloredframe}[2]{
\mdfsetup{
hidealllines=true,
leftline=true,topline=true,
frametitleaboveskip=-5pt,
linewidth=1.5pt,
frametitle={\colorbox{white}{\space#1\space}},
linecolor=#2
}
\begin{mdframed}
}{
\end{mdframed}
}
問題は、見た目は良いのですが、時々奇妙な場所でページが分割され、オプションを削除すると、frametitleaboveskip=-5pt
予想される場所でページが分割されることです。
フレームのタイトルの位置を維持しながら、奇妙なページ区切りを回避するにはどうすればよいでしょうか?
奇妙なページ区切りの例:
frametitleaboveskip
がない場合の外観、適切なページ区切り、フレーム タイトルの位置が適切でない例Diseño
:
編集: ムウェ
\documentclass[letterpaper, 12pt, oneside, spanish]{tesis}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{mdframed}
\usepackage{blindtext}
\newenvironment{coloredframe}[3][]{
\mdfsetup{
hidealllines=true,
leftline=true,topline=true,
frametitleaboveskip=-5pt,
frametitle={\colorbox{white}{\space#2\space}},
linecolor=#3,
#1
}
\begin{mdframed}
}{
\end{mdframed}
}
\newenvironment{investigationfr}[1][]
{\begin{coloredframe}[#1]{Investigación}{blue}}
{\end{coloredframe}}
\begin{document}
\section{Section}
\begin{investigationfr}
\blindtext\\
\blindtext\\
\blindtext\\
\blindtext\\
\end{investigationfr}
\end{document}
答え1
私はアドバイスに従ってtカラーボックスそしてこの解決策を思いつきました。それは完璧に動作します:
\tcbuselibrary{skins}
\tcbuselibrary{breakable}
\newtcolorbox{coloredframe}[3][]{
empty,
breakable=true,
sharp corners=all,
top=4mm, left=4mm,
borderline west={1.5pt}{0pt}{#3}, borderline north={1.5pt}{0pt}{#3},
attach boxed title to top left={yshift=-1.75ex,xshift=6ex},
coltitle=black,
colback=white, colbacktitle=white,
fonttitle=\bfseries,
boxed title style={boxrule=0pt,colframe=white},
title=#2,
#1
}
次のように使用します:
\begin{coloredframe}{Investigation}{blue}
% paragraph
\end{coloredframe}