% Copyright (C) 2015 Yuri Stepanenko stepanenkoyra@gmail.com % This program is free software; you can redistribute it % and/or modify it under the terms of the GNU Library General Public % License as published by the Free Software Foundation; either version 2 % of the License, or (at your option) any later version. % The GNU LIBICONV Library is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % Library General Public License for more details. % You should have received a copy of the GNU Library General Public % License along with the 'eskdi'; see the file License.gpl. % If not, write to the Free Software Foundation, Inc., 59 Temple Place - % Suite 330, Boston, MA 02111-1307, USA. \NeedsTeXFormat{LaTeX2e} \RequirePackage{ifthen} \RequirePackage{eso-pic} \RequirePackage{everyshi} \RequirePackage{lastpage} \RequirePackage{everypage} \ProvidesPackage{for_all_styles} [2015/02/02 v3.0 GOST Frames] \newcounter{gostszv}% \newcounter{gostszvv}% \newlength{\gostorigline}% \newlength{\gostadnomin}% \newsavebox{\newgostboxik}% \newlength{\dx}% \newlength{\dy}% \newcounter{StampACounter} \setcounter{StampACounter}{4}% \newcommand\SetRomanfont{Times New Roman}% \newcommand\SetSansfont{Arial}% \newcommand\SetMonofont{Courier New}% \newcommand\SetMainfont{Times New Roman} % this allows to use sans-serif as default font \setromanfont{\SetRomanfont} \setsansfont{\SetSansfont} \setmonofont{\SetMonofont} \setmainfont{\SetMainfont} % this allows to use sans-serif as default font \newcommand\SetStampfont{\SetMainfont}% \newcommand\SetStampfontIt{}% %\renewcommand{\normalfont}{\fontspec[Scale=1.0]{\SetStampfont}}% \newcommand{\normalfontit}{\fontspec[Scale=1.0]{\SetStampfont} \SetStampfontIt}% %\renewcommand{\small}{\fontspec[Scale=0.75]{\SetStampfont}}% %\newcommand{\smallit}{\fontspec[Scale=0.75]{\SetStampfont}\itshape}% %\renewcommand{\large}{\fontspec[Scale=1.3]{\SetStampfont}}% %\newcommand{\llarge}{\fontspec[Scale=1.2]{\SetStampfont}}% %\renewcommand{\Large}{\fontspec[Scale=1.75]{\SetStampfont}}% %\newcommand{\LLarge}{\fontspec[Scale=1.65]{\SetStampfont}}% \newcommand{\largeit}{\fontspec[Scale=1.3]{\SetStampfont} \SetStampfontIt}% %\newcommand{\llargeit}{\fontspec[Scale=1.2]{\SetStampfont}\itshape}% \newcommand{\Largeit}{\fontspec[Scale=1.75]{\SetStampfont} \SetStampfontIt}% %\newcommand{\LLargeit}{\fontspec[Scale=1.65]{\SetStampfont}\itshape}% \newlength{\pcbdoclinethick}% \setlength{\pcbdoclinethick}{0.5mm}% \newlength{\pcbdoclinethin}% \setlength{\pcbdoclinethin}{0.3mm}% %\makeatletter \newcommand{\getlengthExcludePt}[1]{\strip@pt#1} %You can remove the pt unit from the length using \strip@pt as shown below. I you want the number in cm you would have to convert it by yourself. % Or rounded back to `cm` (there will be some rounding errors!) %\newcommand*{\getlength}[1]{\strip@pt\dimexpr0.035146\dimexpr#1\relax\relax} %\makeatother \newcommand\SetEvenPage% Совсем пустая страници, не нумерованная {% }% % begin{Для вывода текста в бокс с указанными координатами углов %1,2 координаты x,y левого нижнего угла, 3,4 правого верхнего угла % 5 выравнивание 6 текст} \def\spbox#1#2#3#4#5#6 {% \put(#1,#2) {% \setcounter{gostszv}{#3}% \setcounter{gostszvv}{#4}% \setcounter{gostszv}{\value{gostszv}-#1}% \setcounter{gostszvv}{\value{gostszvv}-#2}% \makebox(\value{gostszv},\value{gostszvv})[#5]{#6}% }% } \def\spboxmm#1#2#3#4#5#6 {% \setlength{\dx}{#3mm - #1mm}% \setlength{\dy}{#4mm - #2mm}% \setlength{\dx}{\dx/\real{2.84526}}% Команда \the\dx печатает в pt с добавлением pt в конце. Нам нужно в миллиметрах без mm в конце. Поэтому переводим в миллиметры, и \getlengthExcludePt{} убирает pt вк конце \setlength{\dy}{\dy/\real{2.84526}}% \put(#1, #2) {% \makebox(\getlengthExcludePt{\dx}, \getlengthExcludePt{\dy})[#5]{#6}% }% }% \def\spformedbox#1#2#3#4#5#6 {% \setcounter{gostszv}{#3}% \setcounter{gostszvv}{#4}% \setcounter{gostszv}{\value{gostszv}-#1}% \setcounter{gostszvv}{\value{gostszvv}-#2}% \setlength{\gostadnomin}{#3pt - #1pt}%ширина поля {% \sbox{\newgostboxik}{#6}% \put(#1,#2) { \ifthenelse{\lengthtest{\gostorigline<\gostadnomin}}% {% \makebox(\value{gostszv},\value{gostszvv})[#5]% {\usebox{\newgostboxik}} }% {\makebox(\value{gostszv},\value{gostszvv})[#5]{\resizebox{\gostadnomin}{\height}{\usebox{\newgostboxik}}}}% }% }% } \def\spformedboxmm#1#2#3#4#5#6 {% \setlength{\dx}{#3mm - #1mm}% \setlength{\dy}{#4mm - #2mm}% \setlength{\gostadnomin}{#3mm - #1mm}%ширина поля \sbox{\newgostboxik}{#6}% \setlength{\dx}{\dx/\real{2.84526}}% Команда \the\dx печатает в pt с добавлением pt в конце. Нам нужно в миллиметрах без mm в конце. Поэтому переводим в миллиметры, и \getlengthExcludePt{} убирает pt вк конце \setlength{\dy}{\dy/\real{2.84526}}% \settowidth{\gostorigline}{\usebox{\newgostboxik}}% \setlength{\gostadnomin}{\gostadnomin - 1.5mm}% % \setlength{\gostadnomin}{\gostadnomin/\real{\SetStampfontShorter}}% \put(#1, #2) {% \ifthenelse{\lengthtest{\gostorigline<\gostadnomin}}% {% \makebox(\getlengthExcludePt{\dx}, \getlengthExcludePt{\dy})[#5]{\usebox{\newgostboxik}}% }% {% \setlength{\gostadnomin}{\gostadnomin + 0.5mm}% \makebox(\getlengthExcludePt{\dx}, \getlengthExcludePt{\dy})[#5]{\resizebox{\gostadnomin}{\height}{\usebox{\newgostboxik}}}% }% }% }% % Вывод текста в вертикальный бокс \def\vspbox#1#2#3#4#5#6 {% \put(#1,#2) {% \setcounter{gostszv}{#3}% \setcounter{gostszvv}{#4}% \setcounter{gostszv}{\value{gostszv}-#1}% \setcounter{gostszvv}{\value{gostszvv}-#2}% \begin{sideways}% \makebox(\value{gostszv},\value{gostszvv})[#5]{#6}% \end{sideways}% }% }% % end{Для вывода текста в бокс с указанными координатами углов %1,2 координаты x,y левого нижнего угла, 3,4 правого верхнего угла % 5 выравнивание 6 текст} % Вывод текста в вертикальный бокс \def\vspboxmmI#1#2#3#4#5#6 {% \put(#1,#2) {% \setlength{\dx}{#3mm - #1mm}% \setlength{\dy}{#4mm - #2mm}% \setlength{\dx}{\dx/\real{2.84526}}% Команда \the\dx печатает в pt с добавлением pt в конце. Нам нужно в миллиметрах без mm в конце. Поэтому переводим в миллиметры, и \getlengthExcludePt{} убирает pt вк конце \setlength{\dy}{\dy/\real{2.84526}}% \begin{sideways}% \makebox(\getlengthExcludePt{\dy}, \getlengthExcludePt{\dx})[#5]{#6}% \end{sideways}% }% }% \def\vspformedboxmmI#1#2#3#4#5#6 {% \setlength{\dx}{#3mm - #1mm}% \setlength{\dy}{#4mm - #2mm}% \setlength{\gostadnomin}{#4mm - #2mm}%ширина поля \sbox{\newgostboxik}{#6}% \setlength{\dx}{\dx/\real{2.84526}}% Команда \the\dx печатает в pt с добавлением pt в конце. Нам нужно в миллиметрах без mm в конце. Поэтому переводим в миллиметры, и \getlengthExcludePt{} убирает pt вк конце \setlength{\dy}{\dy/\real{2.84526}}% \settowidth{\gostorigline}{\usebox{\newgostboxik}}% \setlength{\gostadnomin}{\gostadnomin - 1.5mm}% \put(#1, #2) {% \begin{sideways}% \ifthenelse{\lengthtest{\gostorigline<\gostadnomin}}% {% \makebox(\getlengthExcludePt{\dy}, \getlengthExcludePt{\dx})[#5]{\usebox{\newgostboxik}}% }% {% \setlength{\gostadnomin}{\gostadnomin + 0.5mm}% \makebox(\getlengthExcludePt{\dy}, \getlengthExcludePt{\dx})[#5]{\resizebox{\gostadnomin}{\height}{\usebox{\newgostboxik}}}% }% \end{sideways}% }% }% % Вывод текста в вертикальный бокс \def\vspboxmm#1#2#3#4#5#6 {% \setlength{\dx}{#3mm - #1mm}% \setlength{\dy}{#4mm - #2mm}% \setlength{\dx}{\dx/\real{2.84526}}% Команда \the\dx печатает в pt с добавлением pt в конце. Нам нужно в миллиметрах без mm в конце. Поэтому переводим в миллиметры, и \getlengthExcludePt{} убирает pt вк конце \setlength{\dy}{\dy/\real{2.84526}}% \put(#1,#2) {% \begin{sideways}% \makebox(\getlengthExcludePt{\dy}, \getlengthExcludePt{\dx})[#5]{#6}% \end{sideways}% }% }% \def\vspformedboxmm#1#2#3#4#5#6 {% \setlength{\dx}{#3mm - #1mm}% \setlength{\dy}{#4mm - #2mm}% \setlength{\gostadnomin}{#4mm - #2mm}%ширина поля \sbox{\newgostboxik}{#6}% \setlength{\dx}{\dx/\real{2.84526}}% Команда \the\dx печатает в pt с добавлением pt в конце. Нам нужно в миллиметрах без mm в конце. Поэтому переводим в миллиметры, и \getlengthExcludePt{} убирает pt вк конце \setlength{\dy}{\dy/\real{2.84526}}% \settowidth{\gostorigline}{\usebox{\newgostboxik}}% \setlength{\gostadnomin}{\gostadnomin - 1.5mm}% \put(#1, #2) {% \begin{sideways}% \ifthenelse{\lengthtest{\gostorigline<\gostadnomin}}% {% \makebox(\getlengthExcludePt{\dy}, \getlengthExcludePt{\dx})[#5]{\usebox{\newgostboxik}}% }% {% \setlength{\gostadnomin}{\gostadnomin + 0.5mm}% \makebox(\getlengthExcludePt{\dy}, \getlengthExcludePt{\dx})[#5]{\resizebox{\gostadnomin}{\height}{\usebox{\newgostboxik}}}% }% \end{sideways}% }% }% % begin{После вывода каждой страницы выполняем следующий код для вывода рамок} \def\pathtosharedresource{./eskdi/} \def\StampA#1 {% \setcounter{StampACounter}{#1}% }% \def\PageSizeFormat{\ifcase\value{StampACounter} %% Default format \pdfpageheight=\paperheight% \pdfpagewidth=\paperwidth% \setlength{\textwidth}{175mm}% \setlength{\textheight}{24.7cm} \or % A1 \pdfpagewidth=841mm% \pdfpageheight=594mm% \setlength{\textwidth}{804mm}% A1 \setlength{\textheight}{54.4cm} \or % A2 \pdfpagewidth=594mm% \pdfpageheight=420mm% \setlength{\textwidth}{557mm}% A2 \setlength{\textheight}{37.0cm} \or % A3 \pdfpagewidth=420mm% \pdfpageheight=297mm% \setlength{\textwidth}{383mm}% A3 \setlength{\textheight}{24.7cm} \or \pdfpageheight=\paperheight% \pdfpagewidth=\paperwidth% \setlength{\textwidth}{175mm}% \setlength{\textheight}{24.7cm} \else \typeout{} \fi } \def\TextSizeFormat#1{\ifcase#1 %% Default format \setlength{\hsize}{175mm} \setlength{\vsize}{247mm} % \setlength{\textheight}{24.7cm} \or % A1 \setlength{\hsize}{804mm}% A1 \setlength{\vsize}{544mm} % \setlength{\textheight}{54.4cm} \or % A2 \setlength{\hsize}{557mm}% A2 \setlength{\vsize}{370mm} % \setlength{\textheight}{37.0cm} \or % A3 \setlength{\hsize}{383mm}% A3 \setlength{\vsize}{247mm} % \setlength{\textheight}{24.7cm} \or \setlength{\hsize}{175mm} \setlength{\vsize}{247mm} % \setlength{\textheight}{24.7cm} \else \typeout{} \fi } \def\StampFormatI{\ifcase\value{StampACounter} %% Default format \begin{picture}(0,0)(504,763) %A4 \or \begin{picture}(0,0)(2294,1613) %A1 \or \begin{picture}(0,0)(1591,1113) %A2 \or \begin{picture}(0,0)(1096,763) %A3 \or \begin{picture}(0,0)(504,763) %A4 \else \typeout{} \fi } \renewcommand{\@makefnmark}{\hbox{\mathsurround=0pt$^{\@thefnmark)}$}} % Переопределим вид сносок (добавим круглую скобку) %\newcommand{\@makefntext}[1]{\parindent=1em\noindent % \hbox to 1.8em{\hss\@makefnmark}#1} \newcommand\titlePicture{}