액자의 아날로그 수레

액자의 아날로그 수레

저는 LaTeX에 대한 경험이 거의 없습니다. 그럼 내 무지를 용서해 주세요. 하지만 에 해당하는 float가 있습니까 \framebox?

이상적으로는 페이지 상단 [t] 또는 하단 [b]에 배치할 수 있는 프레임 텍스트에 대한 간단한 구성을 원합니다.

내 요구 사항을 제대로 해결하지 못하는 것 같은 게시물 두 개를 발견했습니다.

  1. 플로트가 포함된 프레임된 텍스트
  2. 텍스트와 그림 주위의 프레임

답변1

tcolorbox다음은 부동 상자를 만드는 데 사용하는 대안입니다 .

첫 번째 버전은 최소한의 접근 방식입니다.

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{framefloat}[1][!tb]{arc=0pt,outer arc=0pt,boxrule=0.4pt,
  colframe=black,colback=white,float=#1}

\begin{document}

\begin{framefloat}
\textbf{Box on top:}
\lipsum[2]
\end{framefloat}

\begin{framefloat}[b]
\textbf{Box on bottom:}
\lipsum[2]
\end{framefloat}

\lipsum[1-3]

\end{document}

여기에 이미지 설명을 입력하세요

tcolorbox당신이 그런 것을 찾고 있다면 훨씬 더 많은 옵션을 사용하여 더 멋진 스타일을 만들 수 있습니다. 두 번째 버전은 일부 색상 옵션을 사용하고 옵션 매개변수를 교환하여 쉼표로 구분된 옵션 목록을 가져옵니다. 이 float옵션은 알려진 부동 매개변수를 사용합니다.

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{framefloat}[1][]{fonttitle=\bfseries,
  colframe=yellow!30!black,colback=yellow!10!white,float=!tb,#1}

\begin{document}

\begin{framefloat}[title=Box on top]
\lipsum[2]
\end{framefloat}

\begin{framefloat}[title=Box on bottom,float=b]
\lipsum[2]
\end{framefloat}

\lipsum[1-3]

\end{document}

여기에 이미지 설명을 입력하세요

답변2

\documentclass{scrartcl}
\usepackage{varwidth}
\newsavebox\FBox
\newenvironment{framefloat}[1][!htb]
  {\begin{table}[#1]\centering\begin{lrbox}{\FBox}
   \varwidth{\dimexpr\linewidth-2\fboxsep-2\fboxrule}}
  {\endvarwidth\end{lrbox}\fbox{\usebox\FBox}\end{table}}

\usepackage{blindtext}

\begin{document}

\blindtext

\begin{framefloat}[t]
\blindtext
\end{framefloat}

\blindtext

\begin{framefloat}
\blindtext
\end{framefloat}

\end{document}

여기에 이미지 설명을 입력하세요

답변3

다음은 다음과 같은 조합을 사용하는 옵션입니다.mdframed,newfloat, 그리고xparse패키지( 에 의해 로드됨 mdframed).

다음 줄:

\DeclareFloatingEnvironment[placement={!ht}]{myfloat}

라는 새로운 부동 환경을 선언합니다 myfloat.기본의 배치 !ht및 재정의될 수 있습니다.

다음 줄은 패키지 myfloat의 환경과 결합되는 새로운 부동 환경을 만듭니다 mdframed.

\NewDocumentEnvironment{framefloat}{O{}O{}}
    {% #1: float position (optional)
     % #2: options for mdframed (optional)
     \begin{myfloat}[#1]
    \begin{mdframed}[roundcorner=10pt,backgroundcolor=green,#2]
    }
    {\end{mdframed}\end{myfloat}
    }

보시다시피 패키지의 구문을 사용하여 xparse두 개의 선택적 인수를 선언합니다.

    % #1: float position (optional)
    % #2: options for mdframed (optional)

예를 들어 다음과 같은 방법으로 사용할 수 있습니다.

\begin{framefloat}

\begin{framefloat}[t]

\begin{framefloat}[b][backgroundcolor=blue]

\begin{framefloat}[][backgroundcolor=red]

여기에 완전한 MWE가 있습니다. 제가 사용해본 각 패키지에는많이더 많은 기능; 당신이 적합하다고 생각하는대로 탐색하십시오.

% arara: pdflatex
\documentclass{article}
\usepackage{newfloat}
\usepackage{lipsum}
\usepackage[framemethod=TikZ]{mdframed}

% new float
\DeclareFloatingEnvironment[placement={!ht}]{myfloat}

% new floating framed environment
\NewDocumentEnvironment{framefloat}{O{}O{}}
    {\begin{myfloat}[#1]
    \begin{mdframed}[roundcorner=10pt,backgroundcolor=green,#2]
    }
    {\end{mdframed}\end{myfloat}
    }

\begin{document}

\lipsum

\begin{framefloat}
\lipsum[1]
\end{framefloat}

\lipsum

\begin{framefloat}[t]
\lipsum[1]
\end{framefloat}

\lipsum

\begin{framefloat}[b][backgroundcolor=blue]
\lipsum[1]
\end{framefloat}

\lipsum

\begin{framefloat}[][backgroundcolor=red]
\lipsum[1]
\end{framefloat}


\end{document} 

관련 정보