사진 한 장은 100단어 이상입니다. 점을 (자동으로) 상단에 적절하게 정렬하려면 어떻게 해야 합니까?
현재 사용중인 코드는여기:
\documentclass[12pt]{article}
%% packages
\usepackage{amsmath,multicol,graphics,enumerate}
\usepackage{graphicx}
\usepackage[margin=1cm]{geometry}
\makeatletter
\DeclareRobustCommand{\periodfl}[1]{\@periodflold#1\@nil\relax}
\def\@periodflold#1#2{%
\ifx#2\relax
\expandafter\@gobble
\else
\expandafter\@firstofone
\fi
{\@periodflold@i#1#2}%
}
\def\@periodflold@i#1#2{%
\dot{#1}%
\ifx#2\@nil
\expandafter\@gobble
\else
\expandafter\@firstofone
\fi
{\@periodflold@ii#2}%
}
\def\@periodflold@ii#1#2{%
\ifx#2\@nil
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{\dot{#1}}{#1\@periodflold@ii#2}%
}
\makeatother
\begin{document}
\pagestyle{empty}
\setlength{\parindent}{0pt}
Prove that $0.\periodfl{0x}=\frac{x}{99}$.
\end{document}
감사해요!
답변1
\vphantom{0}
다음 두 인스턴스에 인수를 추가하기만 하면 됩니다 \dot
.
\documentclass{article}
\makeatletter
\DeclareRobustCommand{\periodfl}[1]{\@periodflold#1\@nil\relax}
\def\@periodflold#1#2{%
\ifx#2\relax
\expandafter\@gobble
\else
\expandafter\@firstofone
\fi
{\@periodflold@i#1#2}%
}
\def\@periodflold@i#1#2{%
\dot{\vphantom{0}#1}%
\ifx#2\@nil
\expandafter\@gobble
\else
\expandafter\@firstofone
\fi
{\@periodflold@ii#2}%
}
\def\@periodflold@ii#1#2{%
\ifx#2\@nil
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{\dot{\vphantom{0}#1}}{#1\@periodflold@ii#2}%
}
\makeatother
\begin{document}
Prove that $0.\periodfl{0x}=\frac{x}{99}$.
Prove that $0.\periodfl{00x}=\frac{x}{999}$.
\end{document}
완전성을 위해 버전에 대한 수정 사항은 다음과 같습니다 expl3
.
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
%% Dots on the first and last digit
\NewDocumentCommand{\periodfl}{m}
{
\repdec_initial_final_dots:n { #1 }
}
\seq_new:N \l__repdec_digits_seq
\tl_new:N \l__repdec_first_tl
\tl_new:N \l__repdec_last_tl
\cs_new_protected:Npn \repdec_initial_final_dots:n #1
{
\seq_set_split:Nnn \l__repdec_digits_seq {} { #1 }
\seq_pop_left:NN \l__repdec_digits_seq \l__repdec_first_tl
\seq_pop_right:NN \l__repdec_digits_seq \l__repdec_last_tl
\quark_if_no_value:VF \l__repdec_first_tl { \dot{\vphantom{0}\l__repdec_first_tl} }
\seq_use:Nn \l__repdec_digits_seq {}
\quark_if_no_value:VF \l__repdec_last_tl { \dot{\vphantom{0}\l__repdec_last_tl} }
}
\cs_generate_variant:Nn \quark_if_no_value:nF { V }
\ExplSyntaxOff
\begin{document}
Prove that $0.\periodfl{0x}=\frac{x}{99}$.
Prove that $0.\periodfl{00x}=\frac{x}{999}$.
\end{document}