[cstex] Symboly pro dolni a horni integral

petr zemánek petr.zemanek at gmail.com
Wed Apr 6 11:42:45 CEST 2011


Dobry den,
potřebuji vytvořit příkaz pro symboly dolního a horní integrálu. Našel
jsem tento návod

====================================================

\documentclass{report}
\usepackage{localloc}

% Ignore whitespace and make @ a letter
%
\endlinechar=-1
\catcode`\ =9
\makeatletter

% Saves the current math style in \everymath, then expands its
argument. The result is that
% the math style is "saved", e.g., for use inside box commands.
%
% Ideally, this should append rather than assign.
%
\newcommand{\mathstyle}[1]{
\mathchoice{\everymath={\displaystyle} #1}
{#1}
{\everymath={\scriptstyle} #1}
{\everymath={\scriptscriptstyle} #1}
}

% upper integral symbol.
%
% Everything happens inside a group, so assignments and allocations
are local.
%
\newcommand{\uint}{{
	\mathstyle{
            \lnewbox\intbox
            \lnewdimen\intwd

% obtain the width of \int. Since the typical integral symbol looks
% roughly like a 45 degree line, we'll need to a line about half this
width.
%
\setbox\intbox=\hbox{\m at th$\int$}
\intwd=\wd\intbox
\divide \intwd by 2\relax

% Setting \baselineskip to 1pt gives us 1pt of space between the line
and \int.
%
% We need to use \moveright, to get the line in the right place (hence
the
% \hrule must be inside a \vbox).
%
\vbox{
\baselineskip=1pt
\moveright \intwd \vbox{\hrule width \intwd}
\hbox{\m at th$\int$}}
}}}

% lower integral symbol.
%
\newcommand{\lint}{{
	\mathstyle{
            \lnewbox\intbox
            \lnewdimen\intwd

            \setbox\intbox=\hbox{\m at th$\int$}
            \intwd=\wd\intbox
            \divide \intwd by 2\relax


           % This is a bit simpler, since we don't need \moveright.
            \vtop{
              \hbox{\m at th$\int$}
              \vskip 1pt
              \hrule width \intwd}
}}}



% Restore whitespace and @
%
\catcode`\ =10
\endlinechar=`^^M
\makeatother


\begin{document}
	$\int_a^b f$ $\uint_a^b f$ $\lint_a^b f$ $\int_a^b f$
	$$\int_a^b f \uint_a^b f \lint_a^b f \int_a^b f$$
\end{document}

==========================================================

jenže ten výstup není příliš pohledný. Meze, u kterých není pruh, jsou
příliš daleko od symbolu integrálu, a naopak u druhé meze je ten pruh
příliš blízko symbolu meze. Můžete mi, prosím, pomoci s vytvořením
kvalitnějšího výstupu.
S pozdravem Petr Zemánek.



More information about the csTeX mailing list