![tikzexample 코드 라인 비머의 자동 줄 바꿈](https://rvso.com/image/305742/tikzexample%20%EC%BD%94%EB%93%9C%20%EB%9D%BC%EC%9D%B8%20%EB%B9%84%EB%A8%B8%EC%9D%98%20%EC%9E%90%EB%8F%99%20%EC%A4%84%20%EB%B0%94%EA%BF%88.png)
비머에서 tkzexample 패키지를 사용하여 일부 코드를 데모하면(참조이 예),때때로 코드가 프레임 상자 밖으로 실행될 수 있습니다.
- 코드 줄이 너무 길면 자동으로 줄바꿈되도록 할 수 있나요?
- 두 번째 다이어그램과 세 번째 다이어그램 사이의 거리가 동일하지 않은 것 같습니다.
예제 코드:
\documentclass[t]{beamer}
\usepackage{tikz}
\usepackage{tkzexample}
\colorlet{graphicbackground}{red!10!white}%
\colorlet{codebackground}{blue!10!white}%
\colorlet{codeonlybackground}{blue!10!white}
\begin{document}
\begin{frame}[fragile]{tikz example}
\begin{tkzexample}[width=2cm]
\begin{tikzpicture}
\draw (0,0) node[circle,
shade,
ball color=orange,
minimum size=2cm]{};
\end{tikzpicture}
\end{tkzexample}
\begin{tkzltxexample}[line frame width=0pt]
\begin{tkzexample}[width=1cm]
\tikz[baseline]
\node [circle,line width=1ex,draw=blue,fill=blue]
{\textcolor{white}{\Large{TikZ}}};
\end{tkzexample}
\end{tkzltxexample}
\begin{tkzexample}[width=1.7cm]
\tikz[baseline]
\node [circle,line width=1ex,draw=blue,fill=blue]
{\textcolor{white}{\Large{TikZ}}};
\end{tkzexample}
\end{frame}
\end{document}
산출:
답변1
바꿔도 괜찮다면tcolorbox
package 대신 다음 tkzexample
과 같은 작업을 수행할 수 있습니다.
tcolorbox
listings
코드 조판을 위해 (또는 )를 사용 minted
하고 해당 옵션(글꼴 스타일, 줄 번호 매기기, 줄 바꿈 등)을 목록 부분에 적용할 수 있습니다. 봤는데 tkzexample
활용도가 없는 것 같아요.
현재 그림에 배경색을 추가하는 방법을 모르겠습니다 TiKZ
. 우리는 알고 있습니다. text outside listing
그러나 text side listing
이 경우에는 코드와 결과 상자가 구분되지 않습니다.
\documentclass[t]{beamer}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\newtcblisting{tkzexample}[1][]{text outside listing, fonttitle=\bfseries, bicolor, colback=blue!10!white, colbacklower=red!10!white, colframe=black, sharp corners, frame hidden, size=tight, #1}
\newtcblisting{tkzltxexample}[1][]{listing only, fonttitle=\bfseries, bicolor, colback=blue!10!white,colbacklower=red!10!white, colframe=black, sharp corners, frame hidden, size=tight, #1}
\begin{document}
\begin{frame}[fragile]{tikz example}
\begin{tkzexample}[lefthand width=2cm]
\begin{tikzpicture}
\draw (0,0) node[circle,
shade,
ball color=orange,
minimum size=2cm]{};
\end{tikzpicture}
\end{tkzexample}
\begin{tkzltxexample}[listing only]
\begin{tkzexample}[width=1cm]
\tikz[baseline]
\node [circle, line width=1ex, draw=blue, fill=blue]
{\textcolor{white}{\Large{TikZ}}};
\end{tkzexample}
\end{tkzltxexample}
%
\begin{tkzexample}[lefthand width=1.5cm]
\tikz[baseline]
\node [circle, line width=1ex, draw=blue, fill=blue]
{\textcolor{white}{\Large{TikZ}}};
\end{tkzexample}
\end{frame}
\end{document}