def reduce_stop_parameter(node: ast.expr) -> ast.expr:
    """Adjusts the stop expression of the range.

    This function tries to convert the syntax as follows:
        * n + 1 --> n
        * n + 2 --> n + 1
        * n - 1 --> n - 2

    Args:
        node: The target expression.

    Returns:
        Converted expression.
    """
    if not (isinstance(node, ast.BinOp) and isinstance(node.op, (ast.Add, ast.Sub))):
        return ast.BinOp(left=node, op=ast.Sub(), right=ast_utils.make_constant(1))

    # Treatment for Python 3.7.
    rhs = (
        ast.Constant(value=node.right.n)
        if sys.version_info.minor < 8 and isinstance(node.right, ast.Num)
        else node.right
    )

    if not isinstance(rhs, ast.Constant):
        return ast.BinOp(left=node, op=ast.Sub(), right=ast_utils.make_constant(1))

    shift = 1 if isinstance(node.op, ast.Add) else -1

    return (
        node.left
        if rhs.value == shift
        else ast.BinOp(
            left=node.left,
            op=node.op,
            right=ast_utils.make_constant(value=rhs.value - shift),
        )
    )
Adjusts the stop expression of the range.

    This function tries to convert the syntax as follows:
        * n + 1 --> n
        * n + 2 --> n + 1
        * n - 1 --> n - 2

    Args:
        node: The target expression.

    Returns:
        Converted expression.
    
src/latexify/analyzers.py