AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / computer / Perguntas / 1479681
Accepted
Dead_Ling0
Dead_Ling0
Asked: 2019-09-07 07:05:49 +0800 CST2019-09-07 07:05:49 +0800 CST 2019-09-07 07:05:49 +0800 CST

Latex tabularx problema com espaçamento

  • 772

Então, apenas tentando editar uma tabela que alguém fez no tabularx como eu gostei do estilo, no entanto, não tenho ideia do que realmente estou fazendo e, como tal, me deparei com um problema. Há um grande espaço após a entrada 'setup', no código abaixo e eu gostaria que tudo fosse bom e simétrico, o espaço o torna muito assimétrico. Existe uma maneira de remover esse espaço?

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{ragged2e}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}


\begin{document}
    \noindent
    \edef\TabularRowHeight{\the\dimexpr-\arraystretch\baselineskip}

    \begin{tabularx}{\textwidth}{YY}
    \toprule
    Alice  &  Bob \\
    \midrule
    \emph{Setup}\\
    \cmidrule(lr){1-1}
    Alice \& Bob select a prime $p$ and a generator $g$ for the finite field $\mathbb{F}_p$
    &\\

    &\emph{Private Computation}\\
    \cmidrule(lr){2-2}
    &  Bob randomly selects $b \in \mathbb{F}_p$ and then computes the following:

     $B \equiv g^b \mod p$ once computed Bob sends Alice $B$

     \\[\TabularRowHeight] & \\

    & \emph{Key Computation}\\
    \cmidrule(lr){2-2}
    & Bob who now has $A$, calculates the following:$A^b \equiv (g^a)^b \equiv g^{ab} \mod p$

     \\


    \emph{Private Computation}\\ 
    \cmidrule(lr){1-1}
    Alice randomly selects $a \in \mathbb{F}_p$ and then computes the following:

    $A \equiv g^a \mod p$ once computed Alice sends Bob $A$ & \\ \pagebreak

    \emph{Key Computation}\\ 
    \cmidrule(lr){1-1}
    Alice who now has $B$, calculates the  following:$B^a \equiv (g^b)^a \equiv g^{ab} \mod p$ & \\


    \bottomrule


    \end{tabularx}
\end{document}

Imagem da saída atual

Saída que gostaria de alcançar

latex
  • 1 1 respostas
  • 544 Views

1 respostas

  • Voted
  1. Best Answer
    samcarter_is_at_topanswers.xyz
    2019-09-07T07:56:10+08:002019-09-07T07:56:10+08:00

    Não acho que remover o layout alternativo da tabela que você mostrou faça muito sentido, mas aqui está uma tentativa

    \documentclass{article}
    \usepackage{array}
    \usepackage{booktabs}
    \usepackage{ragged2e}
    \usepackage{tabularx}
    \usepackage{amsmath}
    \usepackage{amsfonts}
    \usepackage{amssymb}
    \newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
    
    
    \begin{document}
            \emph{Setup}: Alice \& Bob select a prime $p$ and a generator $g$ for the finite field $\mathbb{F}_p$
        \begin{tabularx}{\textwidth}{@{}YY@{}}
        \toprule
        Alice  &  Bob \\
        \midrule
        \addlinespace[1.2em]
        \emph{Private Computation}:&\\ \addlinespace
    %    \cmidrule(r){1-1}\cmidrule(l){2-2}
        Alice randomly selects $a \in \mathbb{F}_p$ and then computes the following:
    
        $A \equiv g^a \mod p$ once computed Alice sends Bob $A$& Bob randomly selects $b \in \mathbb{F}_p$ and then computes the following:
    
         $B \equiv g^b \mod p$ once computed Bob sends Alice $B$\\\addlinespace[1.2em]
    
         \emph{Key Computation}: &\\ \addlinespace
    %    \cmidrule(r){1-1}\cmidrule(l){2-2}
        Alice who now has $B$, calculates the  following:$B^a \equiv (g^b)^a \equiv g^{ab} \mod p$  & Bob who now has $A$, calculates the following:$A^b \equiv (g^a)^b \equiv g^{ab} \mod p$
         \\
        \bottomrule
    
    
        \end{tabularx}
    \end{document}
    

    insira a descrição da imagem aqui

    Em vez disso, eu preferiria um layout de 3 colunas:

    \documentclass{article}
    \usepackage{array}
    \usepackage{booktabs}
    \usepackage{ragged2e}
    \usepackage{tabularx}
    \usepackage{amsmath}
    \usepackage{amsfonts}
    \usepackage{amssymb}
    \newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
    
    
    \begin{document}
            \emph{Setup}: Alice \& Bob select a prime $p$ and a generator $g$ for the finite field $\mathbb{F}_p$
        \begin{tabularx}{\textwidth}{@{}>{\RaggedRight\arraybackslash}p{2.2cm}YY@{}}
        \toprule
        & Alice  &  Bob \\
        \midrule
        \emph{Private \linebreak Computation} & %    
        Alice randomly selects $a \in \mathbb{F}_p$ and then computes the following:
    
        $A \equiv g^a \mod p$ once computed Alice sends Bob $A$& Bob randomly selects $b \in \mathbb{F}_p$ and then computes the following:
    
         $B \equiv g^b \mod p$ once computed Bob sends Alice $B$\\\addlinespace
         \emph{Key \linebreak Computation} & Alice who now has $B$, calculates the  following:$B^a \equiv (g^b)^a \equiv g^{ab} \mod p$  & Bob who now has $A$, calculates the following:$A^b \equiv (g^a)^b \equiv g^{ab} \mod p$
         \\
        \bottomrule
    
    
        \end{tabularx}
    \end{document}
    

    insira a descrição da imagem aqui

    • 0

relate perguntas

  • Problema LaTeX com bibliografia

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    O visualizador de fotos do Windows não pode ser executado porque não há memória suficiente?

    • 5 respostas
  • Marko Smith

    Como faço para ativar o WindowsXP agora que o suporte acabou?

    • 6 respostas
  • Marko Smith

    Área de trabalho remota congelando intermitentemente

    • 7 respostas
  • Marko Smith

    Serviço do Windows 10 chamado AarSvc_70f961. O que é e como posso desativá-lo?

    • 2 respostas
  • Marko Smith

    O que significa ter uma máscara de sub-rede /32?

    • 6 respostas
  • Marko Smith

    Ponteiro do mouse movendo-se nas teclas de seta pressionadas no Windows?

    • 1 respostas
  • Marko Smith

    O VirtualBox falha ao iniciar com VERR_NEM_VM_CREATE_FAILED

    • 8 respostas
  • Marko Smith

    Os aplicativos não aparecem nas configurações de privacidade da câmera e do microfone no MacBook

    • 5 respostas
  • Marko Smith

    ssl.SSLCertVerificationError: falha na verificação do certificado [SSL: CERTIFICATE_VERIFY_FAILED]: não foi possível obter o certificado do emissor local (_ssl.c:1056)

    • 4 respostas
  • Marko Smith

    Como posso saber em qual unidade o Windows está instalado?

    • 6 respostas
  • Martin Hope
    Albin Como faço para ativar o WindowsXP agora que o suporte acabou? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 O "HTTPS Everywhere" ainda é relevante? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch O Windows 10 exclui muitos arquivos minúsculos muito lentamente. Algo pode ser feito para agilizar? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 Área de trabalho remota congelando intermitentemente 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney Por que colocar um ponto após o URL remove as informações de login? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension Ponteiro do mouse movendo-se nas teclas de seta pressionadas no Windows? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Como Ctrl+C e Ctrl+V funcionam? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca Todos os meus complementos do Firefox foram desativados repentinamente, como posso reativá-los? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK É possível criar um código QR usando texto? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 Altere o nome da ramificação padrão do git init 2019-04-01 06:16:56 +0800 CST

Hot tag

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve