\documentclass{article}
\usepackage{amsmath}
\begin{document}
\newcommand*{\cofrac}[2]{%
{%
\rlap{$\dfrac{1}{\phantom{#1}}$}%
\genfrac{}{}{0pt}{0}{}{#1+#2}%
}%
}
\[
a_0 +
\cofrac{a_1}{
\cofrac{a_2}{
\cofrac{a_3}{
\genfrac{}{}{0pt}{0}{}{\ddots}
}}}
\]
\end{document}
效果图
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cdots}}}
\end{equation*}
\end{document}
效果图
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyvrb}
\setlength{\parindent}{0cm}
\newcommand\latex{\verb}
\DefineVerbatimEnvironment{Latex}{Verbatim}{numbers=left,numbersep=2mm}
\renewcommand\quote[1]{"#1"}
% == PACKAGES USED == %
\usepackage{mathtools}
\usepackage{ifmtarg}
% == DEF : Continued Fractions == %
% Sources :
% * https://groups.google.com/forum/?hl=fr&fromgroups#!topic/fr.comp.text.tex/UrUZiurKwm0
% * http://tex.stackexchange.com/questions/68190/continued-fraction-in-inline-equations/68196#68196
% * http://tex.stackexchange.com/questions/23432/how-to-create-my-own-math-operator-with-limits
\makeatletter
% Operator-like output
\def\contFracOpe{%
\operatornamewithlimits{%
\mathchoice{% * Display style
\vcenter{\hbox{\huge $\mathcal{K}$}}%
}{% * Text style
\vcenter{\hbox{\Large $\mathcal{K}$}}%
}{% * Script style
\mathrm{\mathcal{K}}%
}{% * Script script style
\mathrm{\mathcal{K}}%
}
}
}
% Operation-like output
\newcommand\contFrac{\@ifstar{\@contFracStar}{\@contFracNoStar}}
\def\singleContFrac#1#2{%
\begin{array}{@{}c@{}}%
\multicolumn{1}{c|}{#1}%
\\%
\hline%
\multicolumn{1}{|c}{#2}%
\end{array}%
}
% No star version
\def\@contFracNoStar#1{%
% //\@nil is usefull if only one argument is given.
\mathchoice{% * Display style
\@contFracNoStarDisplay@#1//\@nil%
}{% * Text style
\@contFracNoStarInline@#1//\@nil%
}{% * Script style
\@contFracNoStarInline@#1//\@nil%
}{% * Script script style
\@contFracNoStarInline@#1//\@nil%
}%
}
% No star version - Display style
\def\@contFracNoStarDisplay@#1//#2\@nil{%
\@ifmtarg{#2}{%
#1%
}{%
#1+\cfrac{1}{\@contFracNoStarDisplay@#2\@nil}%
}%
}
% No star version - Inline style
\def\@contFracNoStarInline@#1//#2\@nil{%
\@ifmtarg{#2}{%
#1%
}{%
#1 \@@contFracNoStarInline@@#2\@nil%
}%
}
\def\@@contFracNoStarInline@@#1//#2\@nil{%
\@ifmtarg{#2}{%
+ \singleContFrac{1}{#1}%
}{%
+ \singleContFrac{1}{#1} \@@contFracNoStarInline@@#2\@nil%
}%
}
% Star version
\def\@contFracStar#1{%
\mathchoice{% * Display style
% \@nil is usefull if only one argument is given.
\@contFracStarDisplay@#1\@nil%
}{% * Text style
% //\@nil is usefull if only one argument is given.
\@contFracStarInline@#1//\@nil%
}{% * Script style
\@contFracStarInline@#1//\@nil%
}{% * Script script style
\@contFracStarInline@#1//\@nil%
}%
}
% Star version - Display style
\def\@contFracStarDisplay@#1//#2//#3\@nil{%
\@ifmtarg{#2}{%
#1%
}{%
#1 + \cfrac{#2}{\@contFracStarDisplay@#3\@nil}%
}%
}
% Star version - Inline style
\def\@contFracStarInline@#1//#2\@nil{%
\@ifmtarg{#2}{%
#1%
}{%
#1 \@@contFracStarInline@@#2\@nil%
}%
}
\def\@@contFracStarInline@@#1//#2//#3\@nil{%
\@ifmtarg{#3}{%
+ \singleContFrac{#1}{#2}%
}{%
+ \singleContFrac{#1}{#2} \@@contFracStarInline@@#3\@nil%
}%
}
\makeatother
\begin{document}
\section{Unstarred version}
$\displaystyle \contFrac{u_0 // u_1 // u_2 // \dots // u_n}$
$\contFrac{u_0 // u_1 // u_2 // \dots // u_n}$
\section{Starred version}
$\displaystyle \contFrac*{a // b // c // d // e // f // \dots // y // z}$
$\contFrac*{a // b // c // d // e // f // \dots // y // z}$.
\section{Operator}
$\displaystyle
\contFracOpe_{k=1}^{n} (b_k:c_k)
=
\cfrac{b_1}{\displaystyle \contFrac*{c_1 // b_2 // c_2 // b_3 // \dots // b_n // c_n}}
$
\end{document}
效果图
\documentclass{article}
\usepackage{amsmath,mathtools}
\newcommand*{\underBracket}[2][1]{\underbracket[.6pt][0pt]{~#1\vphantom{g}~}_{\displaystyle #2\vphantom{g+1}}}
\begin{document}
\begin{equation}
a_0 + \underBracket{a_1\mathrlap{{}+ \underBracket{a_2\mathrlap{{} + \underBracket{a_3\mathrlap{{}+{}\raise-2.2ex\hbox{$\smash\ddots$}}}}}}}
\hphantom{a_1 + a_2 + a_3 + {}} % to reset the spacing/aligning
\end{equation}
\end{document}
效果图
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
a_0+
\raisebox{-.25\height}{$\dfrac{1}{a_1\mathrlap{\,+}}$}\mkern15mu
\raisebox{-1.1\height}{$\dfrac{1}{a_2\mathrlap{\,+}}$}\mkern15mu
\raisebox{-2.0\height}{$\dfrac{1}{a_3\mathrlap{\,+}}$}\mkern15mu
\raisebox{-3\height}{$\ddots$}
\]
\end{document}
自定义
% -----------------------------------------------------------------------------------
% Continued fractions for use in math environment
% Use \cofrac{a}{b}{c} for a/(b+c) at highest level
% Set c to a continued fractior to build recursive structure
% Use \cofracel{a}{b}{c} for recursive terms
% Matches line for fractions to correct size
% -----------------------------------------------------------------------------------
% Temporary variables
%
\newlength{\cfDeleted}
\newlength{\cfA}
\newlength{\cfB}
\newlength{\cfC}
\newlength{\cfX}
\newlength{\cfY}
% -----------------------------------------------------------------------------------
\newcommand{\cofrac}[3]
{
\setlength{\cfDeleted}{0pt}
\cofracel{#1}{#2}{#3}\; \hspace{\cfDeleted}
}
% ------------------------------------------------------------------------------------
\newcommand{\cofracel}[3]
{
\settowidth{\cfA}{$#1$}
\settowidth{\cfB}{$#2\;$}
\settowidth{\cfC}{$#3$}
% Calculate B + C and take max of B + C and A
\setlength{\cfY}{\cfB}
\addtolength{\cfY}{\cfC}
\setlength{\cfX}{\maxof{\cfY}{\cfA}}
% \cfX has "true" width of fraction - at least at this level
% Now get 1/2 (A + B + C) and take greater of that and A by itself
\addtolength{\cfY}{\cfA}
\setlength{\cfY}{0.5\cfY}
\setlength{\cfY}{\maxof{\cfY}{\cfA}}
% \cfY has shortened width of fraction
% calculate amount deleted
\setlength{\cfC}{\cfX}
\addtolength{\cfC}{-\cfY}
\addtolength{\cfDeleted}{\cfC}
% Promote to global here and save for later
\global\cfDeleted=\cfDeleted
\setlength{\cfX}{\cfDeleted}
% then draw .. this may include multiple additional recursions
{
\mathrlap{\cfrac{#1}{{#2\;}{#3}}}\hspace{\cfY}
}
% and restore the saved deleted
\global\cfDeleted=\cfX
}
% ------------------------------------------------------------------------------------
\newcommand{\cofracdots}{\genfrac{}{}{0 pt}{}{\phantom{1}}{\ddots}}
% End of continued fractions
% ---------------------------------------------------------------
\cofrac{a}{b+}{\cofracel{aa}{bb+}{\cofracel{aaa}{bbb+}{\cofracdots}}}
效果图
以上选自How to typeset a continued fraction in the following format?
\documentclass{article}
\def\cFrac#1#2{%
\begin{array}{@{}c@{}}\multicolumn{1}{c|}{#1}\\%
\hline\multicolumn{1}{|c}{#2}\end{array}}
\def\cFracB#1#2{%
\vcenter{\hbox{\strut$#1$\,\vrule}\hrule\hbox{\strut\vrule\,$#2$}}}
\begin{document}
$ A + \cFrac{B}{C} + \cFrac{D}{E}$.
$ A + \cFracB{B}{C} + \cFracB{D}{E}$.
\end{document}
\documentclass{standalone}
\usepackage{holtpolt}
\begin{document}
\[
a_0+\polter{1}{a_1}+\polter{1}{a_2}+\cdots+\polter{1}{a_n}+\cdots
\]
\end{document}
效果图
选自How do I typeset continued fractions in Pringsheim's concise notation?