2014 dxdy logo

Научный форум dxdy

Математика, Физика, Computer Science, Machine Learning, LaTeX, Механика и Техника, Химия,
Биология и Медицина, Экономика и Финансовая Математика, Гуманитарные науки




 
 \newcommand для пунктирной рамки
Сообщение03.02.2017, 16:07 
Пытаюсь сделать \newcommand для пунктирной рамки вида:

код: [ скачать ] [ спрятать ]
Используется синтаксис LaTeX
\documentclass[]{beamer}
\usepackage{geometry}
\geometry{landscape,a5paper,left=1mm,right=16mm,top=1mm,bottom=0cm}

\usepackage{tcolorbox}
\tcbuselibrary{skins,hooks}

\usepackage{tikz}
\usetikzlibrary{intersections,spy,matrix}


\newcommand{\BeginBorder}[1]{\parbox[]{#1\linewidth}{\begin{tcolorbox}[enhanced,arc=0.5mm,boxrule=0.5mm,frame hidden,colback=white,borderline={0.5pt}{0mm}{black,dashed},left=0.05mm,right=0.05mm,top=0.25mm,bottom=0.25mm]}
\newcommand{\EndBorder}{\end{tcolorbox}}}

\begin{document}
        \parbox[]{0.57\linewidth}
        {
        \begin{tcolorbox}[enhanced,arc=0.5mm,boxrule=0.5mm,frame hidden,colback=blue!4,borderline={0.5pt}{0mm}{black,dashed},left=0.25mm,right=0.25mm,top=0.25mm,bottom=0.25mm]
                Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text
        \end{tcolorbox}
        }      
\end{document}


Пробую так:
а) для начала рамки с заданием размера parbox
Используется синтаксис LaTeX
\newcommand{\BeginBorder}[1]{\parbox[]{#1\linewidth}{\begin{tcolorbox}[enhanced,arc=0.5mm,boxrule=0.5mm,frame hidden,colback=white,borderline={0.5pt}{0mm}{black,dashed},left=0.05mm,right=0.05mm,top=0.25mm,bottom=0.25mm]}

б) для закрытия рамки и parbox
Используется синтаксис LaTeX
\newcommand{\EndBorder}{\end{tcolorbox}}}


При поптыке создать рамку с помощью \BeginBorder и \EndBorder выдаёт ошибку. Как правильно сделать?

 
 
 
 Re: \newcommand для пунктирной рамки
Сообщение03.02.2017, 17:38 
Аватара пользователя
Покажите на примере, что Вы хотите получить. Т.е. просто конструкцию со всеми параметрами определеннымиу, без всяких  \newcommand. Я подозреваю, что лучше через \newenvironment

 
 
 
 Re: \newcommand для пунктирной рамки
Сообщение03.02.2017, 17:44 
Чтобы вывести текст в рамке сейчас пишу так:
Используется синтаксис LaTeX
        \parbox[]{0.57\linewidth}
        {
        \begin{tcolorbox}[enhanced,arc=0.5mm,boxrule=0.5mm,frame hidden,colback=blue!4,borderline={0.5pt}{0mm}{black,dashed},left=0.25mm,right=0.25mm,top=0.25mm,bottom=0.25mm]
                Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text
        \end{tcolorbox}
        }    


Хочу писать как-то так:
Используется синтаксис LaTeX
 
\BeginBorder{0.57}
Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text
\EndBorder
 

 
 
 
 Re: \newcommand для пунктирной рамки
Сообщение03.02.2017, 18:31 
Аватара пользователя
Parbox was made by Satan! The Lord gave us minipage! :D

код: [ скачать ] [ спрятать ]
Используется синтаксис LaTeX
\documentclass{beamer}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbuselibrary{skins,hooks}
\newenvironment{BB}[1]
{\begin{minipage}{#1\linewidth}\begin{tcolorbox}[enhanced,arc=0.5mm,boxrule=0.5mm,frame hidden,colback=white,borderline={0.5pt}{0mm}{black,dashed},left=0.05mm,right=0.05mm,top=0.25mm,bottom=0.25mm]%
\begin{trivlist}
\item}{ \end{trivlist}\end{tcolorbox}\end{minipage}}
\begin{document}
\begin{frame}

\begin{BB}{.5}
{Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text}
\end{BB}
\end{frame}

\end{document}
 

 
 
 
 Re: \newcommand для пунктирной рамки
Сообщение03.02.2017, 18:37 
А почему minipage лучше чем parbox (кроме "изготовителя")?

 
 
 
 Re: \newcommand для пунктирной рамки
Сообщение03.02.2017, 19:31 
Аватара пользователя
kostao в сообщении #1189536 писал(а):
А почему minipage лучше чем parbox (кроме "изготовителя")?

Внутренняя причина мне неизвестна, но попробуйте заменить \begin{minipage}{X}YYYY\end{minipage} на \parbox.... {YYYY}.

 
 
 [ Сообщений: 6 ] 


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group