📄 latexcad.sty
字号:
% latexcad.sty - enhanced macros for LaTeX CAD program version 1.9
% Updated 17 Dec 1995
% 21/1/96, shadebox bug fix
% 17/5/96 Automatic defaults for one/two column width
% for PostScript figures. PostScript width
% does *not* automatically go back to the default -
% must explicitly use \dfltpostscriptwidth
% 16/7/96 - comments on end of *every* macro line, to
% prevent unwanted side-effects.
% J Leis leis@usq.edu.au
\typeout{ latexcad.sty (V 1.9 Mar 98) - Support for LaTeXCAD drawing package. }
\typeout{ John Leis, leis@usq.edu.au Adapted from various CTAN sources. }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% User Macros for LaTeX, SliTeX %%%
%================================================================
% For LaTeX %
% Placing LaTeX-CAD drawings (.lp)
% \placedrawing{test.lp}{A Diagram.}{fig:test}
% Multi-line format (note position of '%' ):
% \placedrawing{test.lp}%
% {A Diagram.}%
% {fig:test}
%
% \drawingscale{0.4mm}
% \placedrawing[p]{test.lp}{A Diagram.}{fig:test}
% \placedrawing*{test.lp}
% \placedrawing*[p]{test.lp}
% placing GnuPlots (.gp)
% \placegraph{test.gp}{A test graph.}{fig:test}
% \placegraph[p]{test.gp}{A test graph.}{fig:test}
% \placegraph*{test.gp}
% \placegraph*[p]{test.gp}
% Placing encapsulated PostScript (.eps)
% \placepostscript{test.eps}{A test picture.}{fig:test}
% Multi-line format (note position of '%' ):
% \placepostscript{test.eps}%
% {A test picture.}%
% {fig:test}
%
% \setpostscriptwidth{80mm}
% \placepostscript[p]{test.eps}{A test picture.}{fig:test}
% \placepostscript*{test.eps}
% \placepostscript*[p]{test.eps}
%================================================================
%================================================================
% For SliTeX %
% Placing LaTeX-CAD drawings (.sp)
% \drawingscale{0.4mm}
% \placeslidedrawing{test.sp}{ A Slide Drawing }
% Placing GnuPlots (.gp)
% \placeslidegraph{test.gp}{ A Slide Graph }
% Placing encapsulated PostScript
% \setpostscriptwidth{40mm}
% \placeslidepostscript{test.eps}{ A Slide PostScript }
% \placeslidepostscript{test.eps}{ A Slide PostScript }
%================================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%================================================================
% redefine \tenrm
% \tenrm is used in gnuplots, but is not defined
% \it appears better
\newcommand{\tenrm}{\it}%
%================================================================
%================================================================
\newlength{\@drawingscale}% % relative scaling on LaTeX-CAD drawings
\newlength{\@dfltdrawingscale}% % default for this
% *** change here - defaults for one/two columns 17/5/96
\if@twocolumn%
\setlength{\@dfltdrawingscale}{0.5mm}% % default to 0.5mm
\else%
\setlength{\@dfltdrawingscale}{1.0mm}% % default to 1.0mm (full size on LaTeX-CAD)
\fi%
\setlength{\@drawingscale}{\@dfltdrawingscale}%
% set the PostScript figure width back to the default
\def\dfltdrawingscale{\@drawingscale=\@dfltdrawingscale}%
%================================================================
%================================================================
% command to change scale
% use: \drawingscale{0.5mm}
\def\drawingscale#1{\@drawingscale=#1}%
%================================================================
%================================================================
\newlength{\@pswidth}% % width of PostScript figure
\newlength{\@dfltpswidth}% % default for this
% *** change here - defaults for one/two columns 17/5/96
\if@twocolumn%
\setlength{\@dfltpswidth}{80mm}% % default to 80mm for A4 paper
\else%
\setlength{\@dfltpswidth}{160mm}% % default to 160mm for A4 paper
\fi%
\setlength{\@pswidth}{\@dfltpswidth}%
%================================================================
%================================================================
% command to size a PostScript figure's width
% use: \setpostscriptwidth{80mm}
\def\setpostscriptwidth#1{\@pswidth=#1}%
% set the PostScript figure width back to the default
\def\dfltpostscriptwidth{\@pswidth=\@dfltpswidth}%
%================================================================
%================================================================
% Place a LaTeXCAD drawing in a source file
% \placedrawing*[placement]{ filename }{ caption string }{ crossref-label }
% `*' - the last two arguments are missing (ie no `Figure' caption & label )
% [placement] is optional (default is tbp, see Lamport p 176)
%
% Examples:-
% \placedrawing{test.lp}{A Test Picture}{fig:testa} % normal usage
% \drawingscale{0.4mm} % for next drawing only!
% \placedrawing[p]{test.lp}{thecaption}{fig:testb} % on a page of floats
% \placedrawing*{test.lp} % no `Figure' label
% \placedrawing*[p]{test.lp} % as above, but place on a page of floats
% `*' as first arg - no `label' follows later
\def\placedrawing{\@ifstar{\@dwgnl}{\@dwgl}}%
% with label
% see if optional [placement] argument present
\def\@dwgl{ \@ifnextchar[{\@ddwgl}{\@ddwgl[tbp]} }%
% no label macro - default selection
\def\@dwgnl{ \@ifnextchar[{\@ddwgnl}{\@ddwgnl[tbp]} }%
% the final macros
\def\@ddwgl[#1]#2#3#4% % with label
{%
% WITH LABEL,placement=#1,file=#2,caption=#3,label=#4
\setlength{\unitlength}{\@drawingscale}%
\begin{figure}[#1]%
\begin{center} \input #2 \end{center}%
\caption{#3}\label{#4}% % NOTE! \caption MUST come before \label!
\end{figure}%
%%%%%%%%%%\setlength{\@drawingscale}{\@dfltdrawingscale}% % back to default
}%
\def\@ddwgnl[#1]#2% % no label
{%
% NO LABEL,placement=#1,file=#2
\setlength{\unitlength}{\@drawingscale}%
\begin{figure}[#1]%
\begin{center} \input #2 \end{center}%
\end{figure}%
%%%%%%%%%%%\setlength{\@drawingscale}{\@dfltdrawingscale}% % back to default
}%
%================================================================
%================================================================
% Place a GnuPlot graph (with eepic term) in a source file
% \placegraph*[placement]{ filename }{ caption string }{ crossref-label }
% `*' - the last two arguments are missing (ie no `Figure' caption & label )
% [placement] is optional (default is tbp, see Lamport p 176)
%
% Examples:-
% \placegraph{test.gp}{A Test Graph}{fig:testa} % normal usage
% \placegraph[p]{test.gp}{thecaption}{fig:testb} % on a page of floats
% \placegraph*{test.gp} % no `Figure' label
% \placegraph*[p]{test.gp} % as above, but place on a page of floats
% `*' as first arg - no `label' follows later
\def\placegraph{\@ifstar{\@grnl}{\@grl}}%
% with label
% see if optional [placement] argument present
\def\@grl{ \@ifnextchar[{\@dgrl}{\@dgrl[tbp]} }%
% no label macro - default selection
\def\@grnl{ \@ifnextchar[{\@dgrnl}{\@dgrnl[tbp]} }%
% the final macros
\def\@dgrl[#1]#2#3#4% % with label
{%
% WITH LABEL,placement=#1,file=#2,caption=#3,label=#4
\begin{figure}[#1]%
\begin{center} \input #2 \end{center}%
\caption{#3} \label{#4}%
\end{figure}%
%%%%%%%%%%\setlength{\@drawingscale}{1.0mm}% % back to default
}%
\def\@dgrnl[#1]#2% % no label
{%
% NO LABEL,placement=#1,file=#2
\begin{figure}[#1]%
\begin{center} \input #2 \end{center}%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -