零蛋大
零蛋大
这家伙很懒,什么也没写!

注册于 4年前

回答
3
文章
0
关注者
0

我把你的 mathexercise.cls 换了下顺序就能运行了

\makeatletter
\renewcommand{\maketitle}{%
    \begin{titlepage}
    \begin{center}
    \Huge\bfseries\@title 
    \end{center}
    \vspace{3cm}
    \begin{center}
    \@author
    \end{center}    
    \end{titlepage}}
    \makeatother

向老师的 tikz 绘图笔记二 里看到了方案, 也是分段解决, 代码如下

\documentclass[margin=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[samples=200,scale=1.2]
\draw[-Stealth] (-2,0)--(2,0) node[below] {$x$};
\draw[-Stealth] (0,-0.6)--(0,0.8) node[left] {$y$};
\draw[domain=-pi/4:pi/4] plot ({1.414*sqrt(cos(2*\x r))*cos(\x r)},{1.414*sqrt(cos(2*\x r))*sin(\x r)})--(0,0);
\draw[domain=-pi/4:pi/4,rotate=180] plot ({1.414*sqrt(cos(2*\x r))*cos(\x r)},{1.414*sqrt(cos(2*\x r))*sin(\x r)})--(0,0);
\node at (-4pt,-9pt) {$o$};
\node[below] at (-1.65,0) {$-a$};
\node[below] at (1.55,0) {$a$};
\node[align=center] at (0,-1.1) {$(x^2+y^2)^2=a^2(x^2-y^2)$\\
$\rho^2=a^2\cos2\theta$};
\end{tikzpicture}
\end{document}

依据楼上行者的回答,最终的代码及效果整理如下:

法I. 解答源自行者, 使用spacingtricks宏包, \vstrut[深度]{高度}, 接着进行微调.

\documentclass[a5paper]{ctexart}
\usepackage{amsmath}
\newcommand\dif{\mathop{}\!\mathrm{d}}
\usepackage{array}
\usepackage{scalerel}
\newcommand{\longdiv}{\smash{\mkern-0.43mu\vstretch{1.34}{\hstretch{0.9}{)}}\mkern-5.95mu\vstretch{1.34}{\hstretch{0.9}{)}}}}
\usepackage{spacingtricks} %\vstrut[深度]{高度}
\begin{document}
\[\arraycolsep=1pt
  \begin{array}{*1r@{\hskip\arraycolsep}c@{\hskip\arraycolsep}*{8}{>{\displaystyle}r}}
   \vstrut[2.5ex]{3ex} &  &  &  & \frac{1}{2} & + & \frac{3y}{4} & + & \frac{y^2}{8} \\
    \cline{2-9}
    2+y & \longdiv & 1 & + & 2y & + & y^2 &  &  & \\
    &  & 1 & + & \vstrut[2ex]{3ex}\frac{y}{2} &  &  &  &\\
    \cline{3-5}
   \vstrut[2ex]{3.75ex} \strut &  &  &  & \frac{3y}{2} & + & y^2 &  & \\
   \vstrut[2ex]{3.5ex} &  &  &  & \frac{3y}{2} & + & \frac{3y^2}{4} &  \\
    \cline{5-7}
   \vstrut[2ex]{4ex} &  &  &  &  &  & \frac{y^2}{4} &  & \\
   \vstrut[2ex]{4ex} &  &  &  &  &  & \frac{y^2}{4} & + & \frac{y^3}{8}\\
    \cline{7-9}
   \vstrut[2ex]{4ex} &  &  &  &  &  &  & - & \frac{y^3}{8}\\
  \end{array}\]
\end{document}

QQ截图20210804092210.png

法II. 解答源自行者, 使用arraycols宏包的 x 列格式, 接着微调0.5ex

\documentclass[a5paper]{ctexart}
\usepackage{amsmath}
\newcommand\dif{\mathop{}\!\mathrm{d}}
\usepackage{array}
\usepackage{scalerel}
\newcommand{\longdiv}{\smash{\mkern-0.43mu\vstretch{1.34}{\hstretch{0.9}{)}}\mkern-5.95mu\vstretch{1.34}{\hstretch{0.9}{)}}}}
\usepackage{arraycols}
\begin{document}
  \[\arraycolsep=1pt
  \begin{array}{*1x@{\hskip\arraycolsep}x@{\hskip\arraycolsep}*{8}{>{\displaystyle}x}}
    &  &  &  & \frac{1}{2} & + & \frac{3y}{4} & + & \frac{y^2}{8} \\
    \cline{2-9}
    2+y & \longdiv & 1 & + & 2y & + & y^2 &  &  & \\[-0.5ex]
    &  & 1 & + & \frac{y}{2} &  &  &  &\\
    \cline{3-5}
     \strut &  &  &  & \frac{3y}{2} & + & y^2 &  & \\[-0.5ex]
     &  &  &  & \frac{3y}{2} & + & \frac{3y^2}{4} &  \\
    \cline{5-7}
     &  &  &  &  &  & \frac{y^2}{4} &  & \\[-0.5ex]
     &  &  &  &  &  & \frac{y^2}{4} & + & \frac{y^3}{8}\\
    \cline{7-9}
     &  &  &  &  &  &  & - & \frac{y^3}{8}\\
  \end{array}\]
\end{document}

QQ截图20210804095710.png

发布
问题